home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Corel 10 Texture (image/corel10Texture)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: Plain text[LF]
| default
| |
100%
| xdgMime
| text/x-matlab
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 54 68 69 73 20 69 | 73 20 74 68 65 20 73 74 |% This i|s the st|
|00000010| 61 6e 64 61 6c 6f 6e 65 | 20 76 65 72 73 69 6f 6e |andalone| version|
|00000020| 20 6f 66 20 74 68 65 20 | 70 61 70 65 72 0a 0a 25 | of the |paper..%|
|00000030| 20 43 6f 70 79 72 69 67 | 68 74 20 28 63 29 31 39 | Copyrig|ht (c)19|
|00000040| 39 34 2d 31 39 39 35 2c | 20 4d 2e 20 57 65 6c 73 |94-1995,| M. Wels|
|00000050| 68 2c 20 6d 64 77 40 63 | 73 2e 63 6f 72 6e 65 6c |h, mdw@c|s.cornel|
|00000060| 6c 2e 65 64 75 0a 25 20 | 55 6e 6c 69 6d 69 74 65 |l.edu.% |Unlimite|
|00000070| 64 20 64 69 73 74 72 69 | 62 75 74 69 6f 6e 20 61 |d distri|bution a|
|00000080| 6e 64 20 6d 6f 64 69 66 | 69 63 61 74 69 6f 6e 20 |nd modif|ication |
|00000090| 6f 66 20 74 68 69 73 20 | 77 6f 72 6b 20 69 73 20 |of this |work is |
|000000a0| 70 65 72 6d 69 74 74 65 | 64 2c 0a 25 20 61 73 20 |permitte|d,.% as |
|000000b0| 6c 6f 6e 67 20 61 73 20 | 74 68 65 20 6f 72 69 67 |long as |the orig|
|000000c0| 69 6e 61 6c 20 61 75 74 | 68 6f 72 20 69 73 20 63 |inal aut|hor is c|
|000000d0| 72 65 64 69 74 65 64 20 | 61 6e 64 20 74 68 65 20 |redited |and the |
|000000e0| 61 62 6f 76 65 20 63 6f | 70 79 72 69 67 68 74 0a |above co|pyright.|
|000000f0| 25 20 6e 6f 74 69 63 65 | 20 65 6e 74 61 63 74 2e |% notice| entact.|
|00000100| 0a 0a 5c 63 68 61 70 74 | 65 72 7b 5c 6c 61 62 65 |..\chapt|er{\labe|
|00000110| 6c 7b 6d 64 77 7d 50 6f | 72 74 69 6e 67 20 41 70 |l{mdw}Po|rting Ap|
|00000120| 70 6c 69 63 61 74 69 6f | 6e 73 20 74 6f 20 4c 69 |plicatio|ns to Li|
|00000130| 6e 75 78 7d 0a 5c 61 75 | 74 68 6f 72 7b 4d 61 74 |nux}.\au|thor{Mat|
|00000140| 74 20 57 65 6c 73 68 20 | 5c 5c 20 7b 5c 74 74 20 |t Welsh |\\ {\tt |
|00000150| 6d 64 77 40 63 73 2e 63 | 6f 72 6e 65 6c 6c 2e 65 |mdw@cs.c|ornell.e|
|00000160| 64 75 7d 7d 0a 5c 64 61 | 74 65 7b 32 36 20 4a 61 |du}}.\da|te{26 Ja|
|00000170| 6e 75 61 72 79 20 31 39 | 39 35 7d 0a 0a 5c 73 65 |nuary 19|95}..\se|
|00000180| 63 74 69 6f 6e 7b 49 6e | 74 72 6f 64 75 63 74 69 |ction{In|troducti|
|00000190| 6f 6e 7d 0a 0a 50 6f 72 | 74 69 6e 67 20 55 4e 49 |on}..Por|ting UNI|
|000001a0| 58 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 74 |X applic|ations t|
|000001b0| 6f 20 74 68 65 20 4c 69 | 6e 75 78 20 6f 70 65 72 |o the Li|nux oper|
|000001c0| 61 74 69 6e 67 20 73 79 | 73 74 65 6d 20 69 73 20 |ating sy|stem is |
|000001d0| 72 65 6d 61 72 6b 61 62 | 6c 79 0a 65 61 73 79 2e |remarkab|ly.easy.|
|000001e0| 20 4c 69 6e 75 78 2c 20 | 61 6e 64 20 74 68 65 20 | Linux, |and the |
|000001f0| 47 4e 55 20 43 20 6c 69 | 62 72 61 72 79 20 75 73 |GNU C li|brary us|
|00000200| 65 64 20 62 79 20 69 74 | 2c 20 68 61 76 65 20 62 |ed by it|, have b|
|00000210| 65 65 6e 20 64 65 73 69 | 67 6e 65 64 20 77 69 74 |een desi|gned wit|
|00000220| 68 0a 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 70 |h.applic|ations p|
|00000230| 6f 72 74 61 62 69 6c 69 | 74 79 20 69 6e 20 6d 69 |ortabili|ty in mi|
|00000240| 6e 64 2c 20 6d 65 61 6e | 69 6e 67 20 74 68 61 74 |nd, mean|ing that|
|00000250| 20 6d 61 6e 79 20 61 70 | 70 6c 69 63 61 74 69 6f | many ap|plicatio|
|00000260| 6e 73 20 77 69 6c 6c 0a | 63 6f 6d 70 69 6c 65 20 |ns will.|compile |
|00000270| 73 69 6d 70 6c 79 20 62 | 79 20 69 73 73 75 69 6e |simply b|y issuin|
|00000280| 67 20 7b 5c 74 74 20 6d | 61 6b 65 7d 2e 20 54 68 |g {\tt m|ake}. Th|
|00000290| 6f 73 65 20 77 68 69 63 | 68 20 64 6f 6e 27 74 20 |ose whic|h don't |
|000002a0| 67 65 6e 65 72 61 6c 6c | 79 0a 75 73 65 20 73 6f |generall|y.use so|
|000002b0| 6d 65 20 6f 62 73 63 75 | 72 65 20 66 65 61 74 75 |me obscu|re featu|
|000002c0| 72 65 20 6f 66 20 61 20 | 70 61 72 74 69 63 75 6c |re of a |particul|
|000002d0| 61 72 20 69 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |ar imple|mentatio|
|000002e0| 6e 2c 20 6f 72 20 72 65 | 6c 79 0a 73 74 72 6f 6e |n, or re|ly.stron|
|000002f0| 67 6c 79 20 6f 6e 20 75 | 6e 64 6f 63 75 6d 65 6e |gly on u|ndocumen|
|00000300| 74 65 64 20 6f 72 20 75 | 6e 64 65 66 69 6e 65 64 |ted or u|ndefined|
|00000310| 20 62 65 68 61 76 69 6f | 72 20 6f 66 2c 20 73 61 | behavio|r of, sa|
|00000320| 79 2c 20 61 20 70 61 72 | 74 69 63 75 6c 61 72 0a |y, a par|ticular.|
|00000330| 73 79 73 74 65 6d 20 63 | 61 6c 6c 2e 20 0a 0a 4c |system c|all. ..L|
|00000340| 69 6e 75 78 20 69 73 20 | 6d 6f 73 74 6c 79 20 63 |inux is |mostly c|
|00000350| 6f 6d 70 6c 69 61 6e 74 | 20 77 69 74 68 20 49 45 |ompliant| with IE|
|00000360| 45 45 20 53 74 64 20 31 | 30 30 33 2e 31 2d 31 39 |EE Std 1|003.1-19|
|00000370| 38 38 20 28 50 4f 53 49 | 58 2e 31 29 2c 20 62 75 |88 (POSI|X.1), bu|
|00000380| 74 20 0a 68 61 73 20 6e | 6f 74 20 61 63 74 75 61 |t .has n|ot actua|
|00000390| 6c 6c 79 20 62 65 65 6e | 20 63 65 72 74 69 66 69 |lly been| certifi|
|000003a0| 65 64 20 61 73 20 73 75 | 63 68 2e 20 53 69 6d 69 |ed as su|ch. Simi|
|000003b0| 6c 61 72 6c 79 2c 20 4c | 69 6e 75 78 20 61 6c 73 |larly, L|inux als|
|000003c0| 6f 20 0a 69 6d 70 6c 65 | 6d 65 6e 74 73 20 6d 61 |o .imple|ments ma|
|000003d0| 6e 79 20 66 65 61 74 75 | 72 65 73 20 66 6f 75 6e |ny featu|res foun|
|000003e0| 64 20 69 6e 20 74 68 65 | 20 53 56 49 44 20 61 6e |d in the| SVID an|
|000003f0| 64 20 42 53 44 20 73 74 | 72 61 69 6e 73 20 6f 66 |d BSD st|rains of|
|00000400| 20 55 4e 49 58 2c 0a 62 | 75 74 20 61 67 61 69 6e | UNIX,.b|ut again|
|00000410| 20 64 6f 65 73 20 6e 6f | 74 20 6e 65 63 65 73 73 | does no|t necess|
|00000420| 61 72 69 6c 79 20 61 64 | 68 65 72 65 20 74 6f 20 |arily ad|here to |
|00000430| 74 68 65 6d 20 69 6e 20 | 61 6c 6c 20 63 61 73 65 |them in |all case|
|00000440| 73 2e 20 49 6e 20 67 65 | 6e 65 72 61 6c 2c 0a 4c |s. In ge|neral,.L|
|00000450| 69 6e 75 78 20 68 61 73 | 20 62 65 65 6e 20 64 65 |inux has| been de|
|00000460| 73 69 67 6e 65 64 20 74 | 6f 20 62 65 20 63 6f 6d |signed t|o be com|
|00000470| 70 61 74 69 62 6c 65 20 | 77 69 74 68 20 6f 74 68 |patible |with oth|
|00000480| 65 72 20 55 4e 49 58 20 | 69 6d 70 6c 65 6d 65 6e |er UNIX |implemen|
|00000490| 74 61 74 69 6f 6e 73 2c | 0a 74 6f 20 6d 61 6b 65 |tations,|.to make|
|000004a0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 70 6f | applica|tions po|
|000004b0| 72 74 69 6e 67 20 65 61 | 73 69 65 72 2c 20 61 6e |rting ea|sier, an|
|000004c0| 64 20 69 6e 20 61 20 6e | 75 6d 62 65 72 20 6f 66 |d in a n|umber of|
|000004d0| 20 69 6e 73 74 61 6e 63 | 65 73 20 68 61 73 0a 69 | instanc|es has.i|
|000004e0| 6d 70 72 6f 76 65 64 20 | 75 70 6f 6e 20 6f 72 20 |mproved |upon or |
|000004f0| 63 6f 72 72 65 63 74 65 | 64 20 62 65 68 61 76 69 |correcte|d behavi|
|00000500| 6f 72 20 66 6f 75 6e 64 | 20 69 6e 20 74 68 6f 73 |or found| in thos|
|00000510| 65 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |e implem|entation|
|00000520| 73 2e 0a 0a 41 73 20 61 | 6e 20 65 78 61 6d 70 6c |s...As a|n exampl|
|00000530| 65 2c 20 74 68 65 20 7b | 5c 65 6d 20 74 69 6d 65 |e, the {|\em time|
|00000540| 6f 75 74 5c 2f 7d 20 61 | 72 67 75 6d 65 6e 74 20 |out\/} a|rgument |
|00000550| 70 61 73 73 65 64 20 74 | 6f 20 74 68 65 20 7b 5c |passed t|o the {\|
|00000560| 65 6d 20 73 65 6c 65 63 | 74 5c 2f 7d 20 0a 73 79 |em selec|t\/} .sy|
|00000570| 73 74 65 6d 20 63 61 6c | 6c 20 69 73 20 61 63 74 |stem cal|l is act|
|00000580| 75 61 6c 6c 79 20 64 65 | 63 72 65 6d 65 6e 74 65 |ually de|cremente|
|00000590| 64 20 64 75 72 69 6e 67 | 20 74 68 65 20 70 6f 6c |d during| the pol|
|000005a0| 6c 20 6f 70 65 72 61 74 | 69 6f 6e 20 62 79 20 4c |l operat|ion by L|
|000005b0| 69 6e 75 78 2e 20 0a 4f | 74 68 65 72 20 69 6d 70 |inux. .O|ther imp|
|000005c0| 6c 65 6d 65 6e 74 61 74 | 69 6f 6e 73 20 64 6f 6e |lementat|ions don|
|000005d0| 27 74 20 6d 6f 64 69 66 | 79 20 74 68 69 73 20 76 |'t modif|y this v|
|000005e0| 61 6c 75 65 20 61 74 20 | 61 6c 6c 2c 20 61 6e 64 |alue at |all, and|
|000005f0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 0a 77 68 | applica|tions.wh|
|00000600| 69 63 68 20 61 72 65 6e | 27 74 20 65 78 70 65 63 |ich aren|'t expec|
|00000610| 74 69 6e 67 20 74 68 69 | 73 20 63 6f 75 6c 64 20 |ting thi|s could |
|00000620| 62 72 65 61 6b 20 77 68 | 65 6e 20 63 6f 6d 70 69 |break wh|en compi|
|00000630| 6c 65 64 20 75 6e 64 65 | 72 20 4c 69 6e 75 78 2e |led unde|r Linux.|
|00000640| 0a 54 68 65 20 42 53 44 | 20 61 6e 64 20 53 75 6e |.The BSD| and Sun|
|00000650| 4f 53 20 6d 61 6e 20 70 | 61 67 65 73 20 66 6f 72 |OS man p|ages for|
|00000660| 20 7b 5c 65 6d 20 73 65 | 6c 65 63 74 5c 2f 7d 20 | {\em se|lect\/} |
|00000670| 77 61 72 6e 20 74 68 61 | 74 20 0a 69 6e 20 61 20 |warn tha|t .in a |
|00000680| 60 60 66 75 74 75 72 65 | 20 69 6d 70 6c 65 6d 65 |``future| impleme|
|00000690| 6e 74 61 74 69 6f 6e 27 | 27 2c 20 74 68 65 20 73 |ntation'|', the s|
|000006a0| 79 73 74 65 6d 20 63 61 | 6c 6c 20 6d 61 79 20 6d |ystem ca|ll may m|
|000006b0| 6f 64 69 66 79 20 74 68 | 65 0a 74 69 6d 65 6f 75 |odify th|e.timeou|
|000006c0| 74 20 70 6f 69 6e 74 65 | 72 2e 20 55 6e 66 6f 72 |t pointe|r. Unfor|
|000006d0| 74 75 6e 61 74 65 6c 79 | 2c 20 6d 61 6e 79 20 61 |tunately|, many a|
|000006e0| 70 70 6c 69 63 61 74 69 | 6f 6e 73 20 73 74 69 6c |pplicati|ons stil|
|000006f0| 6c 20 61 73 73 75 6d 65 | 0a 74 68 61 74 20 74 68 |l assume|.that th|
|00000700| 65 20 76 61 6c 75 65 20 | 77 69 6c 6c 20 62 65 20 |e value |will be |
|00000710| 75 6e 74 6f 75 63 68 65 | 64 2e 20 0a 0a 54 68 65 |untouche|d. ..The|
|00000720| 20 67 6f 61 6c 20 6f 66 | 20 74 68 69 73 20 70 61 | goal of| this pa|
|00000730| 70 65 72 20 69 73 20 74 | 6f 20 70 72 6f 76 69 64 |per is t|o provid|
|00000740| 65 20 61 6e 20 6f 76 65 | 72 76 69 65 77 20 6f 66 |e an ove|rview of|
|00000750| 20 74 68 65 20 6d 61 6a | 6f 72 0a 69 73 73 75 65 | the maj|or.issue|
|00000760| 73 20 61 73 73 6f 63 69 | 61 74 65 64 20 77 69 74 |s associ|ated wit|
|00000770| 68 20 70 6f 72 74 69 6e | 67 20 61 70 70 6c 69 63 |h portin|g applic|
|00000780| 61 74 69 6f 6e 73 20 74 | 6f 20 4c 69 6e 75 78 2c |ations t|o Linux,|
|00000790| 20 68 69 67 68 6c 69 67 | 68 74 69 6e 67 0a 74 68 | highlig|hting.th|
|000007a0| 65 20 64 69 66 66 65 72 | 65 6e 63 65 73 20 62 65 |e differ|ences be|
|000007b0| 74 77 65 65 6e 20 4c 69 | 6e 75 78 2c 20 50 4f 53 |tween Li|nux, POS|
|000007c0| 49 58 2e 31 2c 20 53 56 | 49 44 2c 20 61 6e 64 20 |IX.1, SV|ID, and |
|000007d0| 42 53 44 20 69 6e 20 74 | 68 65 20 0a 66 6f 6c 6c |BSD in t|he .foll|
|000007e0| 6f 77 69 6e 67 20 61 72 | 65 61 73 3a 20 73 69 67 |owing ar|eas: sig|
|000007f0| 6e 61 6c 20 68 61 6e 64 | 6c 69 6e 67 2c 20 74 65 |nal hand|ling, te|
|00000800| 72 6d 69 6e 61 6c 20 49 | 2f 4f 2c 20 70 72 6f 63 |rminal I|/O, proc|
|00000810| 65 73 73 20 63 6f 6e 74 | 72 6f 6c 0a 61 6e 64 20 |ess cont|rol.and |
|00000820| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 67 61 74 68 |informat|ion gath|
|00000830| 65 72 69 6e 67 2c 20 61 | 6e 64 20 70 6f 72 74 61 |ering, a|nd porta|
|00000840| 62 6c 65 20 63 6f 6e 64 | 69 74 69 6f 6e 61 6c 20 |ble cond|itional |
|00000850| 63 6f 6d 70 69 6c 61 74 | 69 6f 6e 2e 20 0a 0a 5c |compilat|ion. ..\|
|00000860| 73 65 63 74 69 6f 6e 7b | 53 69 67 6e 61 6c 20 68 |section{|Signal h|
|00000870| 61 6e 64 6c 69 6e 67 7d | 0a 0a 4f 76 65 72 20 74 |andling}|..Over t|
|00000880| 68 65 20 79 65 61 72 73 | 2c 20 74 68 65 20 64 65 |he years|, the de|
|00000890| 66 69 6e 69 74 69 6f 6e | 20 61 6e 64 20 73 65 6d |finition| and sem|
|000008a0| 61 6e 74 69 63 73 20 6f | 66 20 73 69 67 6e 61 6c |antics o|f signal|
|000008b0| 73 20 68 61 76 65 20 62 | 65 65 6e 20 0a 6d 6f 64 |s have b|een .mod|
|000008c0| 69 66 69 65 64 20 69 6e | 20 76 61 72 69 6f 75 73 |ified in| various|
|000008d0| 20 77 61 79 73 20 62 79 | 20 64 69 66 66 65 72 65 | ways by| differe|
|000008e0| 6e 74 20 69 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |nt imple|mentatio|
|000008f0| 6e 73 20 6f 66 20 55 4e | 49 58 2e 0a 54 6f 64 61 |ns of UN|IX..Toda|
|00000900| 79 2c 20 74 68 65 72 65 | 20 61 72 65 20 74 77 6f |y, there| are two|
|00000910| 20 6d 61 6a 6f 72 20 63 | 6c 61 73 73 65 73 20 6f | major c|lasses o|
|00000920| 66 20 73 79 6d 62 6f 6c | 73 3a 20 7b 5c 65 6d 20 |f symbol|s: {\em |
|00000930| 75 6e 72 65 6c 69 61 62 | 6c 65 5c 2f 7d 0a 61 6e |unreliab|le\/}.an|
|00000940| 64 20 7b 5c 65 6d 20 72 | 65 6c 69 61 62 6c 65 7d |d {\em r|eliable}|
|00000950| 2e 20 55 6e 72 65 6c 69 | 61 62 6c 65 20 73 69 67 |. Unreli|able sig|
|00000960| 6e 61 6c 73 20 61 72 65 | 20 74 68 6f 73 65 20 66 |nals are| those f|
|00000970| 6f 72 20 77 68 69 63 68 | 20 74 68 65 0a 73 69 67 |or which| the.sig|
|00000980| 6e 61 6c 20 68 61 6e 64 | 6c 65 72 20 64 6f 65 73 |nal hand|ler does|
|00000990| 20 6e 6f 74 20 72 65 6d | 61 69 6e 20 69 6e 73 74 | not rem|ain inst|
|000009a0| 61 6c 6c 65 64 20 6f 6e | 63 65 20 63 61 6c 6c 65 |alled on|ce calle|
|000009b0| 64 2e 20 54 68 65 73 65 | 20 60 60 6f 6e 65 2d 73 |d. These| ``one-s|
|000009c0| 68 6f 74 27 27 0a 73 69 | 67 6e 61 6c 73 20 6d 75 |hot''.si|gnals mu|
|000009d0| 73 74 20 72 65 2d 69 6e | 73 74 61 6c 6c 20 74 68 |st re-in|stall th|
|000009e0| 65 20 73 69 67 6e 61 6c | 20 68 61 6e 64 6c 65 72 |e signal| handler|
|000009f0| 20 77 69 74 68 69 6e 20 | 74 68 65 20 73 69 67 6e | within |the sign|
|00000a00| 61 6c 20 68 61 6e 64 6c | 65 72 0a 69 74 73 65 6c |al handl|er.itsel|
|00000a10| 66 2c 20 69 66 20 74 68 | 65 20 70 72 6f 67 72 61 |f, if th|e progra|
|00000a20| 6d 20 77 69 73 68 65 73 | 20 74 68 65 20 73 69 67 |m wishes| the sig|
|00000a30| 6e 61 6c 20 74 6f 20 72 | 65 6d 61 69 6e 20 69 6e |nal to r|emain in|
|00000a40| 73 74 61 6c 6c 65 64 2e | 20 42 65 63 61 75 73 65 |stalled.| Because|
|00000a50| 0a 6f 66 20 74 68 69 73 | 2c 20 74 68 65 72 65 20 |.of this|, there |
|00000a60| 69 73 20 61 20 72 61 63 | 65 20 63 6f 6e 64 69 74 |is a rac|e condit|
|00000a70| 69 6f 6e 20 69 6e 20 77 | 68 69 63 68 20 74 68 65 |ion in w|hich the|
|00000a80| 20 73 69 67 6e 61 6c 20 | 63 61 6e 20 61 72 72 69 | signal |can arri|
|00000a90| 76 65 20 0a 61 67 61 69 | 6e 20 62 65 66 6f 72 65 |ve .agai|n before|
|00000aa0| 20 74 68 65 20 68 61 6e | 64 6c 65 72 20 69 73 20 | the han|dler is |
|00000ab0| 72 65 2d 69 6e 73 74 61 | 6c 6c 65 64 2c 20 77 68 |re-insta|lled, wh|
|00000ac0| 69 63 68 20 63 61 6e 20 | 63 61 75 73 65 20 74 68 |ich can |cause th|
|00000ad0| 65 20 73 69 67 6e 61 6c | 0a 74 6f 20 65 69 74 68 |e signal|.to eith|
|00000ae0| 65 72 20 62 65 20 6c 6f | 73 74 20 6f 72 20 66 6f |er be lo|st or fo|
|00000af0| 72 20 74 68 65 20 6f 72 | 69 67 69 6e 61 6c 20 62 |r the or|iginal b|
|00000b00| 65 68 61 76 69 6f 72 20 | 6f 66 20 74 68 65 20 73 |ehavior |of the s|
|00000b10| 69 67 6e 61 6c 20 74 6f | 20 62 65 0a 74 72 69 67 |ignal to| be.trig|
|00000b20| 67 65 72 65 64 20 28 73 | 75 63 68 20 61 73 20 6b |gered (s|uch as k|
|00000b30| 69 6c 6c 69 6e 67 20 74 | 68 65 20 70 72 6f 63 65 |illing t|he proce|
|00000b40| 73 73 29 2e 20 54 68 65 | 72 65 66 6f 72 65 2c 20 |ss). The|refore, |
|00000b50| 74 68 65 73 65 20 73 69 | 67 6e 61 6c 73 0a 61 72 |these si|gnals.ar|
|00000b60| 65 20 60 60 75 6e 72 65 | 6c 69 61 62 6c 65 27 27 |e ``unre|liable''|
|00000b70| 20 62 65 63 61 75 73 65 | 20 74 68 65 20 73 69 67 | because| the sig|
|00000b80| 6e 61 6c 20 63 61 74 63 | 68 69 6e 67 20 61 6e 64 |nal catc|hing and|
|00000b90| 20 68 61 6e 64 6c 65 72 | 20 72 65 2d 69 6e 73 74 | handler| re-inst|
|00000ba0| 61 6c 6c 61 74 69 6f 6e | 0a 6f 70 65 72 61 74 69 |allation|.operati|
|00000bb0| 6f 6e 73 20 61 72 65 20 | 6e 6f 6e 61 74 6f 6d 69 |ons are |nonatomi|
|00000bc0| 63 2e 20 0a 0a 55 6e 64 | 65 72 20 75 6e 72 65 6c |c. ..Und|er unrel|
|00000bd0| 69 61 62 6c 65 20 73 69 | 67 6e 61 6c 20 73 65 6d |iable si|gnal sem|
|00000be0| 61 6e 74 69 63 73 2c 20 | 73 79 73 74 65 6d 20 63 |antics, |system c|
|00000bf0| 61 6c 6c 73 20 61 72 65 | 20 6e 6f 74 20 72 65 73 |alls are| not res|
|00000c00| 74 61 72 74 65 64 0a 61 | 75 74 6f 6d 61 74 69 63 |tarted.a|utomatic|
|00000c10| 61 6c 6c 79 20 77 68 65 | 6e 20 69 6e 74 65 72 72 |ally whe|n interr|
|00000c20| 75 70 74 65 64 20 62 79 | 20 61 20 73 69 67 6e 61 |upted by| a signa|
|00000c30| 6c 2e 20 54 68 65 72 65 | 66 6f 72 65 2c 20 69 6e |l. There|fore, in|
|00000c40| 20 6f 72 64 65 72 20 66 | 6f 72 0a 61 20 70 72 6f | order f|or.a pro|
|00000c50| 67 72 61 6d 20 74 6f 20 | 61 63 63 6f 75 6e 74 20 |gram to |account |
|00000c60| 66 6f 72 20 61 6c 6c 20 | 63 61 73 65 73 2c 20 74 |for all |cases, t|
|00000c70| 68 65 20 70 72 6f 67 72 | 61 6d 20 77 6f 75 6c 64 |he progr|am would|
|00000c80| 20 6e 65 65 64 20 74 6f | 20 63 68 65 63 6b 0a 74 | need to| check.t|
|00000c90| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 7b 5c 65 6d |he value| of {\em|
|00000ca0| 20 65 72 72 6e 6f 5c 2f | 7d 20 61 66 74 65 72 20 | errno\/|} after |
|00000cb0| 65 76 65 72 79 20 73 79 | 73 74 65 6d 20 63 61 6c |every sy|stem cal|
|00000cc0| 6c 2c 20 61 6e 64 20 72 | 65 69 73 73 75 65 20 74 |l, and r|eissue t|
|00000cd0| 68 65 0a 73 79 73 74 65 | 6d 20 63 61 6c 6c 20 69 |he.syste|m call i|
|00000ce0| 66 20 69 74 73 20 76 61 | 6c 75 65 20 69 73 20 7b |f its va|lue is {|
|00000cf0| 5c 65 6d 20 45 49 4e 54 | 52 7d 2e 20 0a 0a 41 6c |\em EINT|R}. ..Al|
|00000d00| 6f 6e 67 20 73 69 6d 69 | 6c 61 72 20 6c 69 6e 65 |ong simi|lar line|
|00000d10| 73 2c 20 75 6e 72 65 6c | 69 61 62 6c 65 20 73 69 |s, unrel|iable si|
|00000d20| 67 6e 61 6c 20 73 65 6d | 61 6e 74 69 63 73 20 64 |gnal sem|antics d|
|00000d30| 6f 6e 27 74 20 70 72 6f | 76 69 64 65 0a 61 6e 20 |on't pro|vide.an |
|00000d40| 65 61 73 79 20 77 61 79 | 20 74 6f 20 67 65 74 20 |easy way| to get |
|00000d50| 61 6e 20 61 74 6f 6d 69 | 63 20 70 61 75 73 65 20 |an atomi|c pause |
|00000d60| 6f 70 65 72 61 74 69 6f | 6e 20 28 70 75 74 20 74 |operatio|n (put t|
|00000d70| 68 65 20 70 72 6f 63 65 | 73 73 20 74 6f 0a 73 6c |he proce|ss to.sl|
|00000d80| 65 65 70 20 75 6e 74 69 | 6c 20 61 20 73 69 67 6e |eep unti|l a sign|
|00000d90| 61 6c 20 61 72 72 69 76 | 65 73 29 2e 20 42 65 63 |al arriv|es). Bec|
|00000da0| 61 75 73 65 20 6f 66 20 | 74 68 65 20 75 6e 72 65 |ause of |the unre|
|00000db0| 6c 69 61 62 6c 65 20 6e | 61 74 75 72 65 20 6f 66 |liable n|ature of|
|00000dc0| 0a 72 65 69 6e 73 74 61 | 6c 6c 69 6e 67 20 73 69 |.reinsta|lling si|
|00000dd0| 67 6e 61 6c 20 68 61 6e | 64 6c 65 72 73 2c 20 74 |gnal han|dlers, t|
|00000de0| 68 65 72 65 20 61 72 65 | 20 63 61 73 65 73 20 69 |here are| cases i|
|00000df0| 6e 20 77 68 69 63 68 20 | 61 20 73 69 67 6e 61 6c |n which |a signal|
|00000e00| 20 63 61 6e 0a 61 72 72 | 69 76 65 20 77 69 74 68 | can.arr|ive with|
|00000e10| 6f 75 74 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |out the |program |
|00000e20| 72 65 61 6c 69 7a 69 6e | 67 20 74 68 69 73 2e 20 |realizin|g this. |
|00000e30| 0a 0a 55 6e 64 65 72 20 | 72 65 6c 69 61 62 6c 65 |..Under |reliable|
|00000e40| 20 73 69 67 6e 61 6c 20 | 73 65 6d 61 6e 74 69 63 | signal |semantic|
|00000e50| 73 2c 20 6f 6e 20 74 68 | 65 20 6f 74 68 65 72 20 |s, on th|e other |
|00000e60| 68 61 6e 64 2c 20 74 68 | 65 20 73 69 67 6e 61 6c |hand, th|e signal|
|00000e70| 0a 68 61 6e 64 6c 65 72 | 20 72 65 6d 61 69 6e 73 |.handler| remains|
|00000e80| 20 69 6e 73 74 61 6c 6c | 65 64 20 77 68 65 6e 20 | install|ed when |
|00000e90| 63 61 6c 6c 65 64 2c 20 | 61 6e 64 20 74 68 65 20 |called, |and the |
|00000ea0| 72 61 63 65 20 63 6f 6e | 64 69 74 69 6f 6e 20 66 |race con|dition f|
|00000eb0| 6f 72 0a 72 65 69 6e 73 | 74 61 6c 6c 61 74 69 6f |or.reins|tallatio|
|00000ec0| 6e 20 69 73 20 61 76 6f | 69 64 65 64 2e 20 41 6c |n is avo|ided. Al|
|00000ed0| 73 6f 2c 20 63 65 72 74 | 61 69 6e 20 73 79 73 74 |so, cert|ain syst|
|00000ee0| 65 6d 20 63 61 6c 6c 73 | 20 63 61 6e 20 62 65 0a |em calls| can be.|
|00000ef0| 72 65 73 74 61 72 74 65 | 64 2c 20 61 6e 64 20 61 |restarte|d, and a|
|00000f00| 6e 20 61 74 6f 6d 69 63 | 20 70 61 75 73 65 20 6f |n atomic| pause o|
|00000f10| 70 65 72 61 74 69 6f 6e | 20 69 73 20 61 76 61 69 |peration| is avai|
|00000f20| 6c 61 62 6c 65 20 76 69 | 61 20 74 68 65 0a 50 4f |lable vi|a the.PO|
|00000f30| 53 49 58 20 7b 5c 65 6d | 20 73 69 67 73 75 73 70 |SIX {\em| sigsusp|
|00000f40| 65 6e 64 5c 2f 7d 20 66 | 75 6e 63 74 69 6f 6e 2e |end\/} f|unction.|
|00000f50| 0a 0a 5c 73 75 62 73 65 | 63 74 69 6f 6e 7b 53 69 |..\subse|ction{Si|
|00000f60| 67 6e 61 6c 73 20 75 6e | 64 65 72 20 53 56 52 34 |gnals un|der SVR4|
|00000f70| 2c 20 42 53 44 2c 20 61 | 6e 64 20 50 4f 53 49 58 |, BSD, a|nd POSIX|
|00000f80| 2e 31 7d 0a 0a 54 68 65 | 20 53 56 52 34 20 69 6d |.1}..The| SVR4 im|
|00000f90| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 6f 66 20 |plementa|tion of |
|00000fa0| 73 69 67 6e 61 6c 73 20 | 69 6e 63 6f 72 70 6f 72 |signals |incorpor|
|00000fb0| 61 74 65 73 20 74 68 65 | 20 66 75 6e 63 74 69 6f |ates the| functio|
|00000fc0| 6e 73 0a 7b 5c 65 6d 20 | 73 69 67 6e 61 6c 7d 2c |ns.{\em |signal},|
|00000fd0| 20 7b 5c 65 6d 20 73 69 | 67 73 65 74 7d 2c 20 7b | {\em si|gset}, {|
|00000fe0| 5c 65 6d 20 73 69 67 68 | 6f 6c 64 7d 2c 20 7b 5c |\em sigh|old}, {\|
|00000ff0| 65 6d 20 73 69 67 72 65 | 6c 73 65 7d 2c 20 7b 5c |em sigre|lse}, {\|
|00001000| 65 6d 20 73 69 67 69 67 | 6e 6f 72 65 7d 2c 0a 61 |em sigig|nore},.a|
|00001010| 6e 64 20 7b 5c 65 6d 20 | 73 69 67 70 61 75 73 65 |nd {\em |sigpause|
|00001020| 7d 2e 20 54 68 65 20 7b | 5c 65 6d 20 73 69 67 6e |}. The {|\em sign|
|00001030| 61 6c 5c 2f 7d 20 66 75 | 6e 63 74 69 6f 6e 20 75 |al\/} fu|nction u|
|00001040| 6e 64 65 72 20 53 56 52 | 34 20 69 73 20 0a 69 64 |nder SVR|4 is .id|
|00001050| 65 6e 74 69 63 61 6c 20 | 74 6f 20 74 68 65 20 63 |entical |to the c|
|00001060| 6c 61 73 73 69 63 20 55 | 4e 49 58 20 56 37 20 73 |lassic U|NIX V7 s|
|00001070| 69 67 6e 61 6c 73 2c 20 | 70 72 6f 76 69 64 69 6e |ignals, |providin|
|00001080| 67 20 6f 6e 6c 79 20 75 | 6e 72 65 6c 69 61 62 6c |g only u|nreliabl|
|00001090| 65 0a 73 69 67 6e 61 6c | 73 2e 20 54 68 65 20 6f |e.signal|s. The o|
|000010a0| 74 68 65 72 20 66 75 6e | 63 74 69 6f 6e 73 20 64 |ther fun|ctions d|
|000010b0| 6f 20 70 72 6f 76 69 64 | 65 20 73 69 67 6e 61 6c |o provid|e signal|
|000010c0| 73 20 77 69 74 68 20 61 | 75 74 6f 6d 61 74 69 63 |s with a|utomatic|
|000010d0| 0a 72 65 69 6e 73 74 61 | 6c 6c 61 74 69 6f 6e 20 |.reinsta|llation |
|000010e0| 6f 66 20 74 68 65 20 73 | 69 67 6e 61 6c 20 68 61 |of the s|ignal ha|
|000010f0| 6e 64 6c 65 72 2c 20 62 | 75 74 20 6e 6f 20 73 79 |ndler, b|ut no sy|
|00001100| 73 74 65 6d 20 63 61 6c | 6c 20 72 65 73 74 61 72 |stem cal|l restar|
|00001110| 74 69 6e 67 0a 69 73 20 | 73 75 70 70 6f 72 74 65 |ting.is |supporte|
|00001120| 64 2e 20 0a 0a 55 6e 64 | 65 72 20 42 53 44 2c 20 |d. ..Und|er BSD, |
|00001130| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 73 20 7b 5c |the func|tions {\|
|00001140| 65 6d 20 73 69 67 6e 61 | 6c 7d 2c 20 7b 5c 65 6d |em signa|l}, {\em|
|00001150| 20 73 69 67 76 65 63 7d | 2c 20 7b 5c 65 6d 20 73 | sigvec}|, {\em s|
|00001160| 69 67 62 6c 6f 63 6b 7d | 2c 0a 7b 5c 65 6d 20 73 |igblock}|,.{\em s|
|00001170| 69 67 73 65 74 6d 61 73 | 6b 7d 2c 20 61 6e 64 20 |igsetmas|k}, and |
|00001180| 7b 5c 65 6d 20 73 69 67 | 70 61 75 73 65 7d 20 61 |{\em sig|pause} a|
|00001190| 72 65 20 73 75 70 70 6f | 72 74 65 64 2e 20 41 6c |re suppo|rted. Al|
|000011a0| 6c 20 6f 66 20 74 68 65 | 20 66 75 6e 63 74 69 6f |l of the| functio|
|000011b0| 6e 73 0a 70 72 6f 76 69 | 64 65 20 72 65 6c 69 61 |ns.provi|de relia|
|000011c0| 62 6c 65 20 73 69 67 6e | 61 6c 73 20 77 69 74 68 |ble sign|als with|
|000011d0| 20 73 79 73 74 65 6d 20 | 63 61 6c 6c 20 72 65 73 | system |call res|
|000011e0| 74 61 72 74 69 6e 67 20 | 62 79 20 64 65 66 61 75 |tarting |by defau|
|000011f0| 6c 74 2c 20 62 75 74 0a | 74 68 61 74 20 62 65 68 |lt, but.|that beh|
|00001200| 61 76 69 6f 72 20 63 61 | 6e 20 62 65 20 64 69 73 |avior ca|n be dis|
|00001210| 61 62 6c 65 64 20 69 66 | 20 74 68 65 20 70 72 6f |abled if| the pro|
|00001220| 67 72 61 6d 6d 65 72 20 | 77 69 73 68 65 73 2e 0a |grammer |wishes..|
|00001230| 0a 55 6e 64 65 72 20 50 | 4f 53 49 58 2e 31 2c 20 |.Under P|OSIX.1, |
|00001240| 7b 5c 65 6d 20 73 69 67 | 61 63 74 69 6f 6e 7d 2c |{\em sig|action},|
|00001250| 20 7b 5c 65 6d 20 73 69 | 67 70 72 6f 63 6d 61 73 | {\em si|gprocmas|
|00001260| 6b 7d 2c 20 7b 5c 65 6d | 20 73 69 67 70 65 6e 64 |k}, {\em| sigpend|
|00001270| 69 6e 67 7d 2c 0a 61 6e | 64 20 7b 5c 65 6d 20 73 |ing},.an|d {\em s|
|00001280| 69 67 73 75 73 70 65 6e | 64 7d 20 61 72 65 20 70 |igsuspen|d} are p|
|00001290| 72 6f 76 69 64 65 64 2e | 20 4e 6f 74 65 20 74 68 |rovided.| Note th|
|000012a0| 61 74 20 74 68 65 72 65 | 20 69 73 20 6e 6f 20 7b |at there| is no {|
|000012b0| 5c 65 6d 20 73 69 67 6e | 61 6c 7d 0a 66 75 6e 63 |\em sign|al}.func|
|000012c0| 74 69 6f 6e 2c 20 61 6e | 64 20 61 63 63 6f 72 64 |tion, an|d accord|
|000012d0| 69 6e 67 20 74 6f 20 50 | 4f 53 49 58 2e 31 20 69 |ing to P|OSIX.1 i|
|000012e0| 74 20 69 73 20 64 65 70 | 72 65 63 69 61 74 65 64 |t is dep|reciated|
|000012f0| 2e 20 54 68 65 73 65 20 | 66 75 6e 63 74 69 6f 6e |. These |function|
|00001300| 73 0a 70 72 6f 76 69 64 | 65 20 72 65 6c 69 61 62 |s.provid|e reliab|
|00001310| 6c 65 20 73 69 67 6e 61 | 6c 73 2c 20 62 75 74 20 |le signa|ls, but |
|00001320| 73 79 73 74 65 6d 20 63 | 61 6c 6c 20 72 65 73 74 |system c|all rest|
|00001330| 61 72 74 20 62 65 68 61 | 76 69 6f 72 20 69 73 20 |art beha|vior is |
|00001340| 6e 6f 74 0a 64 65 66 69 | 6e 65 64 20 62 79 20 50 |not.defi|ned by P|
|00001350| 4f 53 49 58 2e 20 49 66 | 20 7b 5c 65 6d 20 73 69 |OSIX. If| {\em si|
|00001360| 67 61 63 74 69 6f 6e 7d | 20 69 73 20 75 73 65 64 |gaction}| is used|
|00001370| 20 75 6e 64 65 72 20 53 | 56 52 34 20 61 6e 64 20 | under S|VR4 and |
|00001380| 42 53 44 2c 20 0a 73 79 | 73 74 65 6d 20 63 61 6c |BSD, .sy|stem cal|
|00001390| 6c 20 72 65 73 74 61 72 | 74 69 6e 67 20 69 73 20 |l restar|ting is |
|000013a0| 64 69 73 61 62 6c 65 64 | 20 62 79 20 64 65 66 61 |disabled| by defa|
|000013b0| 75 6c 74 2c 20 62 75 74 | 20 69 74 20 63 61 6e 20 |ult, but| it can |
|000013c0| 62 65 20 74 75 72 6e 65 | 64 0a 6f 6e 20 69 66 20 |be turne|d.on if |
|000013d0| 74 68 65 20 73 69 67 6e | 61 6c 20 66 6c 61 67 20 |the sign|al flag |
|000013e0| 7b 5c 74 74 20 53 41 5c | 5f 52 45 53 54 41 52 54 |{\tt SA\|_RESTART|
|000013f0| 7d 20 69 73 20 73 70 65 | 63 69 66 69 65 64 2e 20 |} is spe|cified. |
|00001400| 0a 0a 54 68 65 72 65 66 | 6f 72 65 2c 20 74 68 65 |..Theref|ore, the|
|00001410| 20 60 60 62 65 73 74 27 | 27 20 77 61 79 20 74 6f | ``best'|' way to|
|00001420| 20 75 73 65 20 73 69 67 | 6e 61 6c 73 20 69 6e 20 | use sig|nals in |
|00001430| 61 20 70 72 6f 67 72 61 | 6d 20 69 73 20 74 6f 20 |a progra|m is to |
|00001440| 75 73 65 0a 7b 5c 65 6d | 20 73 69 67 61 63 74 69 |use.{\em| sigacti|
|00001450| 6f 6e 7d 2c 20 77 68 69 | 63 68 20 61 6c 6c 6f 77 |on}, whi|ch allow|
|00001460| 73 20 79 6f 75 20 74 6f | 20 65 78 70 6c 69 63 69 |s you to| explici|
|00001470| 74 6c 79 20 73 70 65 63 | 69 66 79 20 74 68 65 20 |tly spec|ify the |
|00001480| 62 65 68 61 76 69 6f 72 | 0a 6f 66 20 73 69 67 6e |behavior|.of sign|
|00001490| 61 6c 20 68 61 6e 64 6c | 65 72 73 2e 20 48 6f 77 |al handl|ers. How|
|000014a0| 65 76 65 72 2c 20 7b 5c | 65 6d 20 73 69 67 6e 61 |ever, {\|em signa|
|000014b0| 6c 7d 20 69 73 20 73 74 | 69 6c 6c 20 75 73 65 64 |l} is st|ill used|
|000014c0| 20 69 6e 20 6d 61 6e 79 | 20 0a 61 70 70 6c 69 63 | in many| .applic|
|000014d0| 61 74 69 6f 6e 73 2c 20 | 61 6e 64 20 61 73 20 77 |ations, |and as w|
|000014e0| 65 20 63 61 6e 20 73 65 | 65 20 61 62 6f 76 65 20 |e can se|e above |
|000014f0| 7b 5c 65 6d 20 73 69 67 | 6e 61 6c 7d 20 70 72 6f |{\em sig|nal} pro|
|00001500| 76 69 64 65 73 20 64 69 | 66 66 65 72 65 6e 74 0a |vides di|fferent.|
|00001510| 73 65 6d 61 6e 74 69 63 | 73 20 75 6e 64 65 72 20 |semantic|s under |
|00001520| 53 56 52 34 20 61 6e 64 | 20 42 53 44 2e 0a 0a 5c |SVR4 and| BSD...\|
|00001530| 73 75 62 73 65 63 74 69 | 6f 6e 7b 4c 69 6e 75 78 |subsecti|on{Linux|
|00001540| 20 73 69 67 6e 61 6c 20 | 6f 70 74 69 6f 6e 73 7d | signal |options}|
|00001550| 0a 0a 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |..The fo|llowing |
|00001560| 76 61 6c 75 65 73 20 66 | 6f 72 20 74 68 65 20 7b |values f|or the {|
|00001570| 5c 74 74 20 73 61 5c 5f | 66 6c 61 67 73 7d 20 6d |\tt sa\_|flags} m|
|00001580| 65 6d 62 65 72 20 6f 66 | 20 74 68 65 20 0a 7b 5c |ember of| the .{\|
|00001590| 74 74 20 73 69 67 61 63 | 74 69 6f 6e 7d 20 73 74 |tt sigac|tion} st|
|000015a0| 72 75 63 74 75 72 65 20 | 61 72 65 20 64 65 66 69 |ructure |are defi|
|000015b0| 6e 65 64 20 66 6f 72 20 | 4c 69 6e 75 78 2e 20 0a |ned for |Linux. .|
|000015c0| 5c 62 65 67 69 6e 7b 69 | 74 65 6d 69 7a 65 7d 0a |\begin{i|temize}.|
|000015d0| 5c 69 74 65 6d 20 7b 5c | 74 74 20 53 41 5c 5f 4e |\item {\|tt SA\_N|
|000015e0| 4f 43 4c 44 53 54 4f 50 | 7d 3a 20 44 6f 6e 27 74 |OCLDSTOP|}: Don't|
|000015f0| 20 73 65 6e 64 20 7b 5c | 74 74 20 53 49 47 43 48 | send {\|tt SIGCH|
|00001600| 4c 44 7d 20 77 68 65 6e | 20 61 20 63 68 69 6c 64 |LD} when| a child|
|00001610| 20 70 72 6f 63 65 73 73 | 0a 69 73 20 73 74 6f 70 | process|.is stop|
|00001620| 70 65 64 2e 0a 5c 69 74 | 65 6d 20 7b 5c 74 74 20 |ped..\it|em {\tt |
|00001630| 53 41 5c 5f 52 45 53 54 | 41 52 54 7d 3a 20 46 6f |SA\_REST|ART}: Fo|
|00001640| 72 63 65 20 72 65 73 74 | 61 72 74 20 6f 66 20 63 |rce rest|art of c|
|00001650| 65 72 74 61 69 6e 20 73 | 79 73 74 65 6d 20 63 61 |ertain s|ystem ca|
|00001660| 6c 6c 73 20 77 68 65 6e | 0a 69 6e 74 65 72 72 75 |lls when|.interru|
|00001670| 70 74 65 64 20 62 79 20 | 61 20 73 69 67 6e 61 6c |pted by |a signal|
|00001680| 20 68 61 6e 64 6c 65 72 | 2e 0a 5c 69 74 65 6d 20 | handler|..\item |
|00001690| 7b 5c 74 74 20 53 41 5c | 5f 4e 4f 4d 41 53 4b 7d |{\tt SA\|_NOMASK}|
|000016a0| 3a 20 44 69 73 61 62 6c | 65 20 73 69 67 6e 61 6c |: Disabl|e signal|
|000016b0| 20 6d 61 73 6b 20 28 77 | 68 69 63 68 20 62 6c 6f | mask (w|hich blo|
|000016c0| 63 6b 73 20 73 69 67 6e | 61 6c 73 20 64 75 72 69 |cks sign|als duri|
|000016d0| 6e 67 0a 65 78 65 63 75 | 74 69 6f 6e 20 6f 66 20 |ng.execu|tion of |
|000016e0| 61 20 73 69 67 6e 61 6c | 20 68 61 6e 64 6c 65 72 |a signal| handler|
|000016f0| 29 2e 0a 5c 69 74 65 6d | 20 7b 5c 74 74 20 53 41 |)..\item| {\tt SA|
|00001700| 5c 5f 4f 4e 45 53 48 4f | 54 7d 3a 20 43 6c 65 61 |\_ONESHO|T}: Clea|
|00001710| 72 20 73 69 67 6e 61 6c | 20 68 61 6e 64 6c 65 72 |r signal| handler|
|00001720| 20 61 66 74 65 72 20 65 | 78 65 63 75 74 69 6f 6e | after e|xecution|
|00001730| 2e 20 4e 6f 74 65 20 74 | 68 61 74 0a 53 56 52 34 |. Note t|hat.SVR4|
|00001740| 20 75 73 65 73 20 7b 5c | 74 74 20 53 41 5c 5f 52 | uses {\|tt SA\_R|
|00001750| 45 53 45 54 48 41 4e 44 | 7d 20 74 6f 20 6d 65 61 |ESETHAND|} to mea|
|00001760| 6e 20 74 68 65 20 73 61 | 6d 65 20 74 68 69 6e 67 |n the sa|me thing|
|00001770| 2e 0a 5c 69 74 65 6d 20 | 7b 5c 74 74 20 53 41 5c |..\item |{\tt SA\|
|00001780| 5f 49 4e 54 45 52 52 55 | 50 54 7d 3a 20 44 65 66 |_INTERRU|PT}: Def|
|00001790| 69 6e 65 64 20 75 6e 64 | 65 72 20 4c 69 6e 75 78 |ined und|er Linux|
|000017a0| 2c 20 62 75 74 20 75 6e | 75 73 65 64 2e 20 55 6e |, but un|used. Un|
|000017b0| 64 65 72 20 53 75 6e 4f | 53 2c 0a 73 79 73 74 65 |der SunO|S,.syste|
|000017c0| 6d 20 63 61 6c 6c 73 20 | 77 65 72 65 20 61 75 74 |m calls |were aut|
|000017d0| 6f 6d 61 74 69 63 61 6c | 6c 79 20 72 65 73 74 61 |omatical|ly resta|
|000017e0| 72 74 65 64 2c 20 61 6e | 64 20 74 68 69 73 20 66 |rted, an|d this f|
|000017f0| 6c 61 67 20 64 69 73 61 | 62 6c 65 64 20 74 68 61 |lag disa|bled tha|
|00001800| 74 0a 62 65 68 61 76 69 | 6f 72 2e 0a 5c 69 74 65 |t.behavi|or..\ite|
|00001810| 6d 20 7b 5c 74 74 20 53 | 41 5c 5f 53 54 41 43 4b |m {\tt S|A\_STACK|
|00001820| 7d 3a 20 43 75 72 72 65 | 6e 74 6c 79 20 61 20 6e |}: Curre|ntly a n|
|00001830| 6f 2d 6f 70 2c 20 74 6f | 20 62 65 20 75 73 65 64 |o-op, to| be used|
|00001840| 20 66 6f 72 20 73 69 67 | 6e 61 6c 20 73 74 61 63 | for sig|nal stac|
|00001850| 6b 73 2e 0a 5c 65 6e 64 | 7b 69 74 65 6d 69 7a 65 |ks..\end|{itemize|
|00001860| 7d 0a 0a 4e 6f 74 65 20 | 74 68 61 74 20 50 4f 53 |}..Note |that POS|
|00001870| 49 58 2e 31 20 64 65 66 | 69 6e 65 73 20 6f 6e 6c |IX.1 def|ines onl|
|00001880| 79 20 7b 5c 74 74 20 53 | 41 5c 5f 4e 4f 43 4c 44 |y {\tt S|A\_NOCLD|
|00001890| 53 54 4f 50 7d 2c 20 61 | 6e 64 20 74 68 65 72 65 |STOP}, a|nd there|
|000018a0| 20 61 72 65 0a 73 65 76 | 65 72 61 6c 20 6f 74 68 | are.sev|eral oth|
|000018b0| 65 72 20 6f 70 74 69 6f | 6e 73 20 64 65 66 69 6e |er optio|ns defin|
|000018c0| 65 64 20 62 79 20 53 56 | 52 34 20 6e 6f 74 20 61 |ed by SV|R4 not a|
|000018d0| 76 61 69 6c 61 62 6c 65 | 20 75 6e 64 65 72 20 4c |vailable| under L|
|000018e0| 69 6e 75 78 2e 20 0a 57 | 68 65 6e 20 70 6f 72 74 |inux. .W|hen port|
|000018f0| 69 6e 67 20 61 70 70 6c | 69 63 61 74 69 6f 6e 73 |ing appl|ications|
|00001900| 20 77 68 69 63 68 20 75 | 73 65 20 7b 5c 65 6d 20 | which u|se {\em |
|00001910| 73 69 67 61 63 74 69 6f | 6e 7d 2c 20 79 6f 75 20 |sigactio|n}, you |
|00001920| 6d 61 79 20 68 61 76 65 | 20 74 6f 0a 6d 6f 64 69 |may have| to.modi|
|00001930| 66 79 20 74 68 65 20 76 | 61 6c 75 65 73 20 6f 66 |fy the v|alues of|
|00001940| 20 7b 5c 74 74 20 73 61 | 5c 5f 66 6c 61 67 73 7d | {\tt sa|\_flags}|
|00001950| 20 74 6f 20 67 65 74 20 | 74 68 65 20 61 70 70 72 | to get |the appr|
|00001960| 6f 70 72 69 61 74 65 20 | 62 65 68 61 76 69 6f 72 |opriate |behavior|
|00001970| 2e 0a 0a 5c 73 75 62 73 | 65 63 74 69 6f 6e 7b 7b |...\subs|ection{{|
|00001980| 5c 65 6d 20 73 69 67 6e | 61 6c 5c 2f 7d 20 75 6e |\em sign|al\/} un|
|00001990| 64 65 72 20 4c 69 6e 75 | 78 7d 0a 0a 55 6e 64 65 |der Linu|x}..Unde|
|000019a0| 72 20 4c 69 6e 75 78 2c | 20 74 68 65 20 7b 5c 65 |r Linux,| the {\e|
|000019b0| 6d 20 73 69 67 6e 61 6c | 5c 2f 7d 20 66 75 6e 63 |m signal|\/} func|
|000019c0| 74 69 6f 6e 20 69 73 20 | 65 71 75 69 76 61 6c 65 |tion is |equivale|
|000019d0| 6e 74 20 74 6f 20 75 73 | 69 6e 67 0a 7b 5c 65 6d |nt to us|ing.{\em|
|000019e0| 20 73 69 67 61 63 74 69 | 6f 6e 7d 20 77 69 74 68 | sigacti|on} with|
|000019f0| 20 74 68 65 20 7b 5c 74 | 74 20 53 41 5c 5f 4f 4e | the {\t|t SA\_ON|
|00001a00| 45 53 48 4f 54 7d 20 61 | 6e 64 20 7b 5c 74 74 20 |ESHOT} a|nd {\tt |
|00001a10| 53 41 5c 5f 4e 4f 4d 41 | 53 4b 7d 0a 6f 70 74 69 |SA\_NOMA|SK}.opti|
|00001a20| 6f 6e 73 3b 20 74 68 61 | 74 20 69 73 2c 20 69 74 |ons; tha|t is, it|
|00001a30| 20 63 6f 72 72 65 73 70 | 6f 6e 64 73 20 74 6f 20 | corresp|onds to |
|00001a40| 74 68 65 20 63 6c 61 73 | 73 69 63 2c 20 75 6e 72 |the clas|sic, unr|
|00001a50| 65 6c 69 61 62 6c 65 0a | 73 69 67 6e 61 6c 20 73 |eliable.|signal s|
|00001a60| 65 6d 61 6e 74 69 63 73 | 20 61 73 20 75 73 65 64 |emantics| as used|
|00001a70| 20 75 6e 64 65 72 20 53 | 56 52 34 2e 20 0a 0a 49 | under S|VR4. ..I|
|00001a80| 66 20 79 6f 75 20 77 69 | 73 68 20 7b 5c 65 6d 20 |f you wi|sh {\em |
|00001a90| 73 69 67 6e 61 6c 7d 20 | 74 6f 20 75 73 65 20 42 |signal} |to use B|
|00001aa0| 53 44 20 73 65 6d 61 6e | 74 69 63 73 2c 20 6d 6f |SD seman|tics, mo|
|00001ab0| 73 74 20 4c 69 6e 75 78 | 20 73 79 73 74 65 6d 73 |st Linux| systems|
|00001ac0| 0a 70 72 6f 76 69 64 65 | 20 61 20 42 53 44 20 63 |.provide| a BSD c|
|00001ad0| 6f 6d 70 61 74 69 62 69 | 6c 69 74 79 20 6c 69 62 |ompatibi|lity lib|
|00001ae0| 72 61 72 79 20 77 68 69 | 63 68 20 63 61 6e 20 62 |rary whi|ch can b|
|00001af0| 65 20 6c 69 6e 6b 65 64 | 20 77 69 74 68 2e 20 54 |e linked| with. T|
|00001b00| 6f 20 75 73 65 0a 74 68 | 69 73 20 6c 69 62 72 61 |o use.th|is libra|
|00001b10| 72 79 2c 20 79 6f 75 20 | 63 6f 75 6c 64 20 61 64 |ry, you |could ad|
|00001b20| 64 20 74 68 65 20 6f 70 | 74 69 6f 6e 73 0a 5c 62 |d the op|tions.\b|
|00001b30| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 20 |egin{ver|batim}. |
|00001b40| 20 2d 49 2f 75 73 72 2f | 69 6e 63 6c 75 64 65 2f | -I/usr/|include/|
|00001b50| 62 73 64 20 2d 6c 62 73 | 64 0a 5c 65 6e 64 7b 76 |bsd -lbs|d.\end{v|
|00001b60| 65 72 62 61 74 69 6d 7d | 0a 74 6f 20 74 68 65 20 |erbatim}|.to the |
|00001b70| 63 6f 6d 70 69 6c 61 74 | 69 6f 6e 20 63 6f 6d 6d |compilat|ion comm|
|00001b80| 61 6e 64 20 6c 69 6e 65 | 2e 20 57 68 65 6e 20 70 |and line|. When p|
|00001b90| 6f 72 74 69 6e 67 20 61 | 70 70 6c 69 63 61 74 69 |orting a|pplicati|
|00001ba0| 6f 6e 73 20 75 73 69 6e | 67 0a 7b 5c 65 6d 20 73 |ons usin|g.{\em s|
|00001bb0| 69 67 6e 61 6c 7d 2c 20 | 70 61 79 20 63 6c 6f 73 |ignal}, |pay clos|
|00001bc0| 65 20 61 74 74 65 6e 74 | 69 6f 6e 20 74 6f 20 77 |e attent|ion to w|
|00001bd0| 68 61 74 20 61 73 73 75 | 6d 70 74 69 6f 6e 73 20 |hat assu|mptions |
|00001be0| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 6d 61 6b 65 |the prog|ram make|
|00001bf0| 73 0a 61 62 6f 75 74 20 | 75 73 65 20 6f 66 20 73 |s.about |use of s|
|00001c00| 69 67 6e 61 6c 20 68 61 | 6e 64 6c 65 72 73 2c 20 |ignal ha|ndlers, |
|00001c10| 61 6e 64 20 6d 6f 64 69 | 66 79 20 74 68 65 20 63 |and modi|fy the c|
|00001c20| 6f 64 65 20 28 6f 72 20 | 63 6f 6d 70 69 6c 65 20 |ode (or |compile |
|00001c30| 77 69 74 68 20 74 68 65 | 0a 61 70 70 72 6f 70 72 |with the|.appropr|
|00001c40| 69 61 74 65 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |iate def|initions|
|00001c50| 29 20 74 6f 20 67 65 74 | 20 74 68 65 20 72 69 67 |) to get| the rig|
|00001c60| 68 74 20 62 65 68 61 76 | 69 6f 72 2e 20 0a 0a 5c |ht behav|ior. ..\|
|00001c70| 73 75 62 73 65 63 74 69 | 6f 6e 7b 53 69 67 6e 61 |subsecti|on{Signa|
|00001c80| 6c 73 20 73 75 70 70 6f | 72 74 65 64 20 62 79 20 |ls suppo|rted by |
|00001c90| 4c 69 6e 75 78 7d 0a 0a | 4c 69 6e 75 78 20 73 75 |Linux}..|Linux su|
|00001ca0| 70 70 6f 72 74 73 20 6e | 65 61 72 6c 79 20 65 76 |pports n|early ev|
|00001cb0| 65 72 79 20 73 69 67 6e | 61 6c 20 70 72 6f 76 69 |ery sign|al provi|
|00001cc0| 64 65 64 20 62 79 20 53 | 56 52 34 2c 20 42 53 44 |ded by S|VR4, BSD|
|00001cd0| 2c 20 61 6e 64 20 50 4f | 53 49 58 2c 20 0a 77 69 |, and PO|SIX, .wi|
|00001ce0| 74 68 20 66 65 77 20 65 | 78 63 65 70 74 69 6f 6e |th few e|xception|
|00001cf0| 73 3a 0a 5c 62 65 67 69 | 6e 7b 69 74 65 6d 69 7a |s:.\begi|n{itemiz|
|00001d00| 65 7d 0a 5c 69 74 65 6d | 20 7b 5c 74 74 20 53 49 |e}.\item| {\tt SI|
|00001d10| 47 45 4d 54 7d 20 69 73 | 20 6e 6f 74 20 73 75 70 |GEMT} is| not sup|
|00001d20| 70 6f 72 74 65 64 3b 20 | 69 74 20 63 6f 72 72 65 |ported; |it corre|
|00001d30| 73 70 6f 6e 64 73 20 74 | 6f 20 61 20 68 61 72 64 |sponds t|o a hard|
|00001d40| 77 61 72 65 20 66 61 75 | 6c 74 0a 75 6e 64 65 72 |ware fau|lt.under|
|00001d50| 20 53 56 52 34 20 61 6e | 64 20 42 53 44 2e 0a 5c | SVR4 an|d BSD..\|
|00001d60| 69 74 65 6d 20 7b 5c 74 | 74 20 53 49 47 49 4e 46 |item {\t|t SIGINF|
|00001d70| 4f 7d 20 69 73 20 6e 6f | 74 20 73 75 70 70 6f 72 |O} is no|t suppor|
|00001d80| 74 65 64 3b 20 69 74 20 | 69 73 20 75 73 65 64 20 |ted; it |is used |
|00001d90| 66 6f 72 20 6b 65 79 62 | 6f 61 72 64 20 69 6e 66 |for keyb|oard inf|
|00001da0| 6f 72 6d 61 74 69 6f 6e | 0a 72 65 71 75 65 73 74 |ormation|.request|
|00001db0| 73 20 75 6e 64 65 72 20 | 53 56 52 34 2e 0a 5c 69 |s under |SVR4..\i|
|00001dc0| 74 65 6d 20 7b 5c 74 74 | 20 53 49 47 53 59 53 7d |tem {\tt| SIGSYS}|
|00001dd0| 20 69 73 20 6e 6f 74 20 | 73 75 70 70 6f 72 74 65 | is not |supporte|
|00001de0| 64 3b 20 69 74 20 72 65 | 66 65 72 73 20 74 6f 20 |d; it re|fers to |
|00001df0| 61 6e 20 69 6e 76 61 6c | 69 64 20 73 79 73 74 65 |an inval|id syste|
|00001e00| 6d 20 63 61 6c 6c 0a 69 | 6e 20 53 56 52 34 20 61 |m call.i|n SVR4 a|
|00001e10| 6e 64 20 42 53 44 2e 20 | 49 66 20 79 6f 75 20 6c |nd BSD. |If you l|
|00001e20| 69 6e 6b 20 77 69 74 68 | 20 7b 5c 74 74 20 6c 69 |ink with| {\tt li|
|00001e30| 62 62 73 64 7d 2c 20 74 | 68 69 73 20 73 69 67 6e |bbsd}, t|his sign|
|00001e40| 61 6c 20 69 73 20 72 65 | 64 65 66 69 6e 65 64 0a |al is re|defined.|
|00001e50| 74 6f 20 7b 5c 74 74 20 | 53 49 47 55 4e 55 53 45 |to {\tt |SIGUNUSE|
|00001e60| 44 7d 2e 0a 5c 69 74 65 | 6d 20 7b 5c 74 74 20 53 |D}..\ite|m {\tt S|
|00001e70| 49 47 41 42 52 54 7d 20 | 61 6e 64 20 7b 5c 74 74 |IGABRT} |and {\tt|
|00001e80| 20 53 49 47 49 4f 54 7d | 20 61 72 65 20 69 64 65 | SIGIOT}| are ide|
|00001e90| 6e 74 69 63 61 6c 2e 0a | 5c 69 74 65 6d 20 7b 5c |ntical..|\item {\|
|00001ea0| 74 74 20 53 49 47 49 4f | 7d 2c 20 7b 5c 74 74 20 |tt SIGIO|}, {\tt |
|00001eb0| 53 49 47 50 4f 4c 4c 7d | 2c 20 61 6e 64 20 7b 5c |SIGPOLL}|, and {\|
|00001ec0| 74 74 20 53 49 47 55 52 | 47 7d 20 61 72 65 20 69 |tt SIGUR|G} are i|
|00001ed0| 64 65 6e 74 69 63 61 6c | 2e 0a 5c 69 74 65 6d 20 |dentical|..\item |
|00001ee0| 7b 5c 74 74 20 53 49 47 | 42 55 53 7d 20 69 73 20 |{\tt SIG|BUS} is |
|00001ef0| 64 65 66 69 6e 65 64 20 | 61 73 20 7b 5c 74 74 20 |defined |as {\tt |
|00001f00| 53 49 47 55 4e 55 53 45 | 44 7d 2e 20 54 65 63 68 |SIGUNUSE|D}. Tech|
|00001f10| 6e 69 63 61 6c 6c 79 20 | 74 68 65 72 65 20 69 73 |nically |there is|
|00001f20| 0a 6e 6f 20 60 60 62 75 | 73 20 65 72 72 6f 72 27 |.no ``bu|s error'|
|00001f30| 27 20 69 6e 20 74 68 65 | 20 4c 69 6e 75 78 20 65 |' in the| Linux e|
|00001f40| 6e 76 69 72 6f 6e 6d 65 | 6e 74 2e 20 0a 5c 65 6e |nvironme|nt. .\en|
|00001f50| 64 7b 69 74 65 6d 69 7a | 65 7d 0a 0a 5c 73 65 63 |d{itemiz|e}..\sec|
|00001f60| 74 69 6f 6e 7b 54 65 72 | 6d 69 6e 61 6c 20 49 2f |tion{Ter|minal I/|
|00001f70| 4f 7d 0a 0a 41 73 20 77 | 69 74 68 20 73 69 67 6e |O}..As w|ith sign|
|00001f80| 61 6c 73 2c 20 74 65 72 | 6d 69 6e 61 6c 20 49 2f |als, ter|minal I/|
|00001f90| 4f 20 63 6f 6e 74 72 6f | 6c 20 68 61 73 20 74 68 |O contro|l has th|
|00001fa0| 72 65 65 20 64 69 66 66 | 65 72 65 6e 74 20 69 6d |ree diff|erent im|
|00001fb0| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 73 0a 75 6e |plementa|tions.un|
|00001fc0| 64 65 72 20 53 56 52 34 | 2c 20 42 53 44 2c 20 61 |der SVR4|, BSD, a|
|00001fd0| 6e 64 20 50 4f 53 49 58 | 2e 31 2e 20 0a 0a 53 56 |nd POSIX|.1. ..SV|
|00001fe0| 52 34 20 75 73 65 73 20 | 74 68 65 20 7b 5c 74 74 |R4 uses |the {\tt|
|00001ff0| 20 74 65 72 6d 69 6f 7d | 20 73 74 72 75 63 74 75 | termio}| structu|
|00002000| 72 65 2c 20 61 6e 64 20 | 76 61 72 69 6f 75 73 20 |re, and |various |
|00002010| 7b 5c 65 6d 20 69 6f 63 | 74 6c 7d 20 63 61 6c 6c |{\em ioc|tl} call|
|00002020| 73 20 0a 28 73 75 63 68 | 20 61 73 20 7b 5c 74 74 |s .(such| as {\tt|
|00002030| 20 54 43 53 45 54 41 7d | 2c 20 7b 5c 74 74 20 54 | TCSETA}|, {\tt T|
|00002040| 43 47 45 54 41 7d 2c 20 | 61 6e 64 20 73 6f 20 66 |CGETA}, |and so f|
|00002050| 6f 72 74 68 29 20 6f 6e | 20 61 20 74 65 72 6d 69 |orth) on| a termi|
|00002060| 6e 61 6c 20 0a 64 65 76 | 69 63 65 20 74 6f 20 6f |nal .dev|ice to o|
|00002070| 62 74 61 69 6e 20 61 6e | 64 20 73 65 74 20 70 61 |btain an|d set pa|
|00002080| 72 61 6d 65 74 65 72 73 | 20 77 69 74 68 20 74 68 |rameters| with th|
|00002090| 65 20 7b 5c 74 74 20 74 | 65 72 6d 69 6f 7d 20 73 |e {\tt t|ermio} s|
|000020a0| 74 72 75 63 74 75 72 65 | 2e 0a 54 68 69 73 20 73 |tructure|..This s|
|000020b0| 74 72 75 63 74 75 72 65 | 20 6c 6f 6f 6b 73 20 6c |tructure| looks l|
|000020c0| 69 6b 65 3a 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |ike:.\be|gin{verb|
|000020d0| 61 74 69 6d 7d 0a 20 20 | 73 74 72 75 63 74 20 74 |atim}. |struct t|
|000020e0| 65 72 6d 69 6f 20 7b 0a | 20 20 20 20 75 6e 73 69 |ermio {.| unsi|
|000020f0| 67 6e 65 64 20 73 68 6f | 72 74 20 63 5f 69 66 6c |gned sho|rt c_ifl|
|00002100| 61 67 3b 20 20 2f 2a 20 | 49 6e 70 75 74 20 6d 6f |ag; /* |Input mo|
|00002110| 64 65 73 20 2a 2f 0a 20 | 20 20 20 75 6e 73 69 67 |des */. | unsig|
|00002120| 6e 65 64 20 73 68 6f 72 | 74 20 63 5f 6f 66 6c 61 |ned shor|t c_ofla|
|00002130| 67 3b 20 20 2f 2a 20 4f | 75 74 70 75 74 20 6d 6f |g; /* O|utput mo|
|00002140| 64 65 73 20 2a 2f 0a 20 | 20 20 20 75 6e 73 69 67 |des */. | unsig|
|00002150| 6e 65 64 20 73 68 6f 72 | 74 20 63 5f 63 66 6c 61 |ned shor|t c_cfla|
|00002160| 67 3b 20 20 2f 2a 20 43 | 6f 6e 74 72 6f 6c 20 6d |g; /* C|ontrol m|
|00002170| 6f 64 65 73 20 2a 2f 0a | 20 20 20 20 75 6e 73 69 |odes */.| unsi|
|00002180| 67 6e 65 64 20 73 68 6f | 72 74 20 63 5f 6c 66 6c |gned sho|rt c_lfl|
|00002190| 61 67 3b 20 20 2f 2a 20 | 4c 69 6e 65 20 64 69 73 |ag; /* |Line dis|
|000021a0| 63 69 70 6c 69 6e 65 20 | 6d 6f 64 65 73 20 2a 2f |cipline |modes */|
|000021b0| 0a 20 20 20 20 63 68 61 | 72 20 63 5f 6c 69 6e 65 |. cha|r c_line|
|000021c0| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a |; | /*|
|000021d0| 20 4c 69 6e 65 20 64 69 | 73 63 69 70 6c 69 6e 65 | Line di|scipline|
|000021e0| 20 2a 2f 0a 20 20 20 20 | 75 6e 73 69 67 6e 65 64 | */. |unsigned|
|000021f0| 20 63 68 61 72 20 63 5f | 63 63 5b 4e 43 43 5d 3b | char c_|cc[NCC];|
|00002200| 20 2f 2a 20 43 6f 6e 74 | 72 6f 6c 20 63 68 61 72 | /* Cont|rol char|
|00002210| 61 63 74 65 72 73 20 2a | 2f 0a 20 20 7d 3b 0a 5c |acters *|/. };.\|
|00002220| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 0a 55 |end{verb|atim}..U|
|00002230| 6e 64 65 72 20 42 53 44 | 2c 20 74 68 65 20 7b 5c |nder BSD|, the {\|
|00002240| 74 74 20 73 67 74 74 79 | 7d 20 73 74 72 75 63 74 |tt sgtty|} struct|
|00002250| 75 72 65 20 69 73 20 75 | 73 65 64 20 77 69 74 68 |ure is u|sed with|
|00002260| 20 76 61 72 69 6f 75 73 | 20 7b 5c 65 6d 20 69 6f | various| {\em io|
|00002270| 63 74 6c 7d 0a 63 61 6c | 6c 73 2c 20 73 75 63 68 |ctl}.cal|ls, such|
|00002280| 20 61 73 20 7b 5c 74 74 | 20 54 49 4f 43 47 45 54 | as {\tt| TIOCGET|
|00002290| 50 7d 2c 20 7b 5c 74 74 | 20 54 49 4f 43 53 45 54 |P}, {\tt| TIOCSET|
|000022a0| 50 7d 2c 20 61 6e 64 20 | 73 6f 20 66 6f 72 74 68 |P}, and |so forth|
|000022b0| 2e 0a 0a 55 6e 64 65 72 | 20 50 4f 53 49 58 2c 20 |...Under| POSIX, |
|000022c0| 74 68 65 20 7b 5c 74 74 | 20 74 65 72 6d 69 6f 73 |the {\tt| termios|
|000022d0| 7d 20 73 74 72 75 63 74 | 20 69 73 20 75 73 65 64 |} struct| is used|
|000022e0| 2c 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 76 61 72 |, along |with var|
|000022f0| 69 6f 75 73 20 66 75 6e | 63 74 69 6f 6e 73 0a 64 |ious fun|ctions.d|
|00002300| 65 66 69 6e 65 64 20 62 | 79 20 50 4f 53 49 58 2e |efined b|y POSIX.|
|00002310| 31 2c 20 73 75 63 68 20 | 61 73 20 7b 5c 65 6d 20 |1, such |as {\em |
|00002320| 74 63 73 65 74 61 74 74 | 72 7d 20 61 6e 64 20 7b |tcsetatt|r} and {|
|00002330| 5c 74 74 20 74 63 67 65 | 74 61 74 74 72 7d 2e 20 |\tt tcge|tattr}. |
|00002340| 54 68 65 0a 7b 5c 74 74 | 20 74 65 72 6d 69 6f 73 |The.{\tt| termios|
|00002350| 7d 20 73 74 72 75 63 74 | 75 72 65 20 69 73 20 69 |} struct|ure is i|
|00002360| 64 65 6e 74 69 63 61 6c | 20 74 6f 20 7b 5c 74 74 |dentical| to {\tt|
|00002370| 20 73 74 72 75 63 74 20 | 74 65 72 6d 69 6f 7d 20 | struct |termio} |
|00002380| 75 73 65 64 20 62 79 20 | 53 56 52 34 2c 0a 62 75 |used by |SVR4,.bu|
|00002390| 74 20 74 68 65 20 74 79 | 70 65 73 20 61 72 65 20 |t the ty|pes are |
|000023a0| 72 65 6e 61 6d 65 64 20 | 28 73 75 63 68 20 61 73 |renamed |(such as|
|000023b0| 20 7b 5c 74 74 20 74 63 | 66 6c 61 67 5c 5f 74 7d | {\tt tc|flag\_t}|
|000023c0| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 7b 5c 74 74 | instead| of {\tt|
|000023d0| 20 75 6e 73 69 67 6e 65 | 64 0a 73 68 6f 72 74 7d | unsigne|d.short}|
|000023e0| 29 2c 20 61 6e 64 20 7b | 5c 74 74 20 4e 43 43 53 |), and {|\tt NCCS|
|000023f0| 7d 20 69 73 20 75 73 65 | 64 20 66 6f 72 20 74 68 |} is use|d for th|
|00002400| 65 20 73 69 7a 65 20 6f | 66 20 74 68 65 20 7b 5c |e size o|f the {\|
|00002410| 74 74 20 63 5c 5f 63 63 | 7d 20 61 72 72 61 79 2e |tt c\_cc|} array.|
|00002420| 0a 0a 55 6e 64 65 72 20 | 4c 69 6e 75 78 2c 20 62 |..Under |Linux, b|
|00002430| 6f 74 68 20 50 4f 53 49 | 58 2e 31 20 7b 5c 65 6d |oth POSI|X.1 {\em|
|00002440| 20 74 65 72 6d 69 6f 73 | 7d 20 61 6e 64 20 53 56 | termios|} and SV|
|00002450| 52 34 20 7b 5c 65 6d 20 | 74 65 72 6d 69 6f 7d 20 |R4 {\em |termio} |
|00002460| 61 72 65 20 73 75 70 70 | 6f 72 74 65 64 0a 64 69 |are supp|orted.di|
|00002470| 72 65 63 74 6c 79 20 62 | 79 20 74 68 65 20 6b 65 |rectly b|y the ke|
|00002480| 72 6e 65 6c 2e 20 54 68 | 69 73 20 6d 65 61 6e 73 |rnel. Th|is means|
|00002490| 20 74 68 61 74 20 69 66 | 20 79 6f 75 72 20 70 72 | that if| your pr|
|000024a0| 6f 67 72 61 6d 20 75 73 | 65 73 20 65 69 74 68 65 |ogram us|es eithe|
|000024b0| 72 20 6f 66 0a 74 68 65 | 73 65 20 6d 65 74 68 6f |r of.the|se metho|
|000024c0| 64 73 20 66 6f 72 20 61 | 63 63 65 73 73 69 6e 67 |ds for a|ccessing|
|000024d0| 20 74 65 72 6d 69 6e 61 | 6c 20 49 2f 4f 2c 20 69 | termina|l I/O, i|
|000024e0| 74 20 73 68 6f 75 6c 64 | 20 63 6f 6d 70 69 6c 65 |t should| compile|
|000024f0| 20 64 69 72 65 63 74 6c | 79 20 75 6e 64 65 72 0a | directl|y under.|
|00002500| 4c 69 6e 75 78 2e 20 49 | 66 20 79 6f 75 27 72 65 |Linux. I|f you're|
|00002510| 20 65 76 65 72 20 69 6e | 20 64 6f 75 62 74 2c 20 | ever in| doubt, |
|00002520| 69 74 27 73 20 65 61 73 | 79 20 74 6f 20 6d 6f 64 |it's eas|y to mod|
|00002530| 69 66 79 20 63 6f 64 65 | 20 75 73 69 6e 67 20 0a |ify code| using .|
|00002540| 7b 5c 74 74 20 74 65 72 | 6d 69 6f 7d 20 74 6f 20 |{\tt ter|mio} to |
|00002550| 75 73 65 20 7b 5c 74 74 | 20 74 65 72 6d 69 6f 73 |use {\tt| termios|
|00002560| 7d 2c 20 75 73 69 6e 67 | 20 61 20 62 69 74 20 6f |}, using| a bit o|
|00002570| 66 20 6b 6e 6f 77 6c 65 | 64 67 65 20 6f 66 20 62 |f knowle|dge of b|
|00002580| 6f 74 68 0a 6d 65 74 68 | 6f 64 73 2e 20 48 6f 70 |oth.meth|ods. Hop|
|00002590| 65 66 75 6c 6c 79 2c 20 | 74 68 69 73 20 73 68 6f |efully, |this sho|
|000025a0| 75 6c 64 6e 27 74 20 65 | 76 65 72 20 62 65 20 6e |uldn't e|ver be n|
|000025b0| 65 63 65 73 73 61 72 79 | 2e 20 42 75 74 2c 20 64 |ecessary|. But, d|
|000025c0| 6f 20 70 61 79 20 61 74 | 74 65 6e 74 69 6f 6e 0a |o pay at|tention.|
|000025d0| 69 66 20 61 20 70 72 6f | 67 72 61 6d 20 61 74 74 |if a pro|gram att|
|000025e0| 65 6d 70 74 73 20 74 6f | 20 75 73 65 20 74 68 65 |empts to| use the|
|000025f0| 20 7b 5c 74 74 20 63 5c | 5f 6c 69 6e 65 7d 20 66 | {\tt c\|_line} f|
|00002600| 69 65 6c 64 20 69 6e 20 | 74 68 65 20 7b 5c 74 74 |ield in |the {\tt|
|00002610| 20 74 65 72 6d 69 6f 7d | 0a 73 74 72 75 63 74 75 | termio}|.structu|
|00002620| 72 65 2e 20 46 6f 72 20 | 6e 65 61 72 6c 79 20 61 |re. For |nearly a|
|00002630| 6c 6c 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 73 2c |ll appli|cations,|
|00002640| 20 74 68 69 73 20 73 68 | 6f 75 6c 64 20 62 65 20 | this sh|ould be |
|00002650| 7b 5c 74 74 20 4e 5c 5f | 54 54 59 7d 2c 20 61 6e |{\tt N\_|TTY}, an|
|00002660| 64 0a 69 66 20 74 68 65 | 20 70 72 6f 67 72 61 6d |d.if the| program|
|00002670| 20 61 73 73 75 6d 65 73 | 20 74 68 61 74 20 73 6f | assumes| that so|
|00002680| 6d 65 20 6f 74 68 65 72 | 20 6c 69 6e 65 20 64 69 |me other| line di|
|00002690| 73 63 69 70 6c 69 6e 65 | 20 69 73 20 61 76 61 69 |scipline| is avai|
|000026a0| 6c 61 62 6c 65 0a 79 6f | 75 20 6d 69 67 68 74 20 |lable.yo|u might |
|000026b0| 68 61 76 65 20 74 72 6f | 75 62 6c 65 2e 0a 0a 49 |have tro|uble...I|
|000026c0| 66 20 79 6f 75 72 20 70 | 72 6f 67 72 61 6d 20 75 |f your p|rogram u|
|000026d0| 73 65 73 20 74 68 65 20 | 42 53 44 20 7b 5c 65 6d |ses the |BSD {\em|
|000026e0| 20 73 67 74 74 79 7d 20 | 69 6d 70 6c 65 6d 65 6e | sgtty} |implemen|
|000026f0| 74 61 74 69 6f 6e 2c 20 | 79 6f 75 20 63 61 6e 20 |tation, |you can |
|00002700| 6c 69 6e 6b 0a 61 67 61 | 69 6e 73 74 20 7b 5c 74 |link.aga|inst {\t|
|00002710| 74 20 6c 69 62 62 73 64 | 2e 61 7d 20 61 73 20 64 |t libbsd|.a} as d|
|00002720| 65 73 63 72 69 62 65 64 | 20 61 62 6f 76 65 2e 20 |escribed| above. |
|00002730| 54 68 69 73 20 77 69 6c | 6c 20 70 72 6f 76 69 64 |This wil|l provid|
|00002740| 65 20 61 20 72 65 70 6c | 61 63 65 6d 65 6e 74 0a |e a repl|acement.|
|00002750| 66 6f 72 20 7b 5c 65 6d | 20 69 6f 63 74 6c 7d 20 |for {\em| ioctl} |
|00002760| 77 68 69 63 68 20 77 69 | 6c 6c 20 72 65 73 75 62 |which wi|ll resub|
|00002770| 6d 69 74 20 74 68 65 20 | 74 65 72 6d 69 6e 61 6c |mit the |terminal|
|00002780| 20 49 2f 4f 20 72 65 71 | 75 65 73 74 73 20 69 6e | I/O req|uests in|
|00002790| 20 74 65 72 6d 73 20 6f | 66 0a 74 68 65 20 50 4f | terms o|f.the PO|
|000027a0| 53 49 58 20 7b 5c 74 74 | 20 74 65 72 6d 69 6f 73 |SIX {\tt| termios|
|000027b0| 7d 20 63 61 6c 6c 73 20 | 75 73 65 64 20 62 79 20 |} calls |used by |
|000027c0| 74 68 65 20 6b 65 72 6e | 65 6c 2e 20 57 68 65 6e |the kern|el. When|
|000027d0| 20 63 6f 6d 70 69 6c 69 | 6e 67 20 73 75 63 68 0a | compili|ng such.|
|000027e0| 61 20 70 72 6f 67 72 61 | 6d 2c 20 69 66 20 73 79 |a progra|m, if sy|
|000027f0| 6d 62 6f 6c 73 20 73 75 | 63 68 20 61 73 20 7b 5c |mbols su|ch as {\|
|00002800| 74 74 20 54 49 4f 43 47 | 45 54 50 7d 20 61 72 65 |tt TIOCG|ETP} are|
|00002810| 20 75 6e 64 65 66 69 6e | 65 64 2c 20 79 6f 75 20 | undefin|ed, you |
|00002820| 77 69 6c 6c 0a 6e 65 65 | 64 20 74 6f 20 6c 69 6e |will.nee|d to lin|
|00002830| 6b 20 61 67 61 69 6e 73 | 74 20 7b 5c 74 74 20 6c |k agains|t {\tt l|
|00002840| 69 62 62 73 64 7d 2e 20 | 0a 0a 5c 73 65 63 74 69 |ibbsd}. |..\secti|
|00002850| 6f 6e 7b 50 72 6f 63 65 | 73 73 20 69 6e 66 6f 72 |on{Proce|ss infor|
|00002860| 6d 61 74 69 6f 6e 20 61 | 6e 64 20 63 6f 6e 74 72 |mation a|nd contr|
|00002870| 6f 6c 7d 0a 0a 50 72 6f | 67 72 61 6d 73 20 73 75 |ol}..Pro|grams su|
|00002880| 63 68 20 61 73 20 7b 5c | 65 6d 20 70 73 7d 2c 20 |ch as {\|em ps}, |
|00002890| 7b 5c 65 6d 20 74 6f 70 | 7d 2c 20 61 6e 64 20 7b |{\em top|}, and {|
|000028a0| 5c 74 74 20 66 72 65 65 | 7d 20 6d 75 73 74 20 68 |\tt free|} must h|
|000028b0| 61 76 65 20 73 6f 6d 65 | 20 77 61 79 0a 74 6f 20 |ave some| way.to |
|000028c0| 6f 62 74 61 69 6e 20 69 | 6e 66 6f 72 6d 61 74 69 |obtain i|nformati|
|000028d0| 6f 6e 20 66 72 6f 6d 20 | 74 68 65 20 6b 65 72 6e |on from |the kern|
|000028e0| 65 6c 20 61 62 6f 75 74 | 20 61 20 70 72 6f 63 65 |el about| a proce|
|000028f0| 73 73 65 73 20 61 6e 64 | 20 73 79 73 74 65 6d 20 |sses and| system |
|00002900| 0a 72 65 73 6f 75 72 63 | 65 73 2e 20 53 69 6d 69 |.resourc|es. Simi|
|00002910| 6c 61 72 6c 79 2c 20 64 | 65 62 75 67 67 65 72 73 |larly, d|ebuggers|
|00002920| 20 61 6e 64 20 6f 74 68 | 65 72 20 6c 69 6b 65 20 | and oth|er like |
|00002930| 74 6f 6f 6c 73 20 6e 65 | 65 64 20 74 68 65 20 61 |tools ne|ed the a|
|00002940| 62 69 6c 69 74 79 0a 74 | 6f 20 63 6f 6e 74 72 6f |bility.t|o contro|
|00002950| 6c 20 61 6e 64 20 69 6e | 73 70 65 63 74 20 61 20 |l and in|spect a |
|00002960| 72 75 6e 6e 69 6e 67 20 | 70 72 6f 63 65 73 73 2e |running |process.|
|00002970| 20 54 68 65 73 65 20 66 | 65 61 74 75 72 65 73 20 | These f|eatures |
|00002980| 68 61 76 65 20 62 65 65 | 6e 0a 70 72 6f 76 69 64 |have bee|n.provid|
|00002990| 65 64 20 62 79 20 61 20 | 6e 75 6d 62 65 72 20 6f |ed by a |number o|
|000029a0| 66 20 69 6e 74 65 72 66 | 61 63 65 73 20 62 79 20 |f interf|aces by |
|000029b0| 64 69 66 66 65 72 65 6e | 74 20 76 65 72 73 69 6f |differen|t versio|
|000029c0| 6e 73 20 6f 66 20 55 4e | 49 58 2c 0a 61 6e 64 20 |ns of UN|IX,.and |
|000029d0| 6e 65 61 72 6c 79 20 61 | 6c 6c 20 6f 66 20 74 68 |nearly a|ll of th|
|000029e0| 65 6d 20 61 72 65 20 65 | 69 74 68 65 72 20 6d 61 |em are e|ither ma|
|000029f0| 63 68 69 6e 65 2d 73 70 | 65 63 69 66 69 63 20 6f |chine-sp|ecific o|
|00002a00| 72 20 74 69 65 64 20 74 | 6f 20 61 0a 70 61 72 74 |r tied t|o a.part|
|00002a10| 69 63 75 6c 61 72 20 6b | 65 72 6e 65 6c 20 64 65 |icular k|ernel de|
|00002a20| 73 69 67 6e 2e 20 53 6f | 20 66 61 72 2c 20 74 68 |sign. So| far, th|
|00002a30| 65 72 65 20 68 61 73 20 | 62 65 65 6e 20 6e 6f 20 |ere has |been no |
|00002a40| 75 6e 69 76 65 72 73 61 | 6c 6c 79 2d 61 63 63 65 |universa|lly-acce|
|00002a50| 70 74 65 64 0a 69 6e 74 | 65 72 66 61 63 65 20 66 |pted.int|erface f|
|00002a60| 6f 72 20 74 68 69 73 20 | 6b 69 6e 64 20 6f 66 20 |or this |kind of |
|00002a70| 70 72 6f 63 65 73 73 2d | 6b 65 72 6e 65 6c 20 69 |process-|kernel i|
|00002a80| 6e 74 65 72 61 63 74 69 | 6f 6e 2e 0a 0a 5c 73 75 |nteracti|on...\su|
|00002a90| 62 73 65 63 74 69 6f 6e | 7b 7b 5c 65 6d 20 6b 76 |bsection|{{\em kv|
|00002aa0| 6d 7d 20 72 6f 75 74 69 | 6e 65 73 7d 0a 0a 4d 61 |m} routi|nes}..Ma|
|00002ab0| 6e 79 20 73 79 73 74 65 | 6d 73 20 75 73 65 20 72 |ny syste|ms use r|
|00002ac0| 6f 75 74 69 6e 65 73 20 | 73 75 63 68 20 61 73 20 |outines |such as |
|00002ad0| 7b 5c 65 6d 20 6b 76 6d | 5c 5f 6f 70 65 6e 7d 2c |{\em kvm|\_open},|
|00002ae0| 20 7b 5c 65 6d 20 6b 76 | 6d 5c 5f 6e 6c 69 73 74 | {\em kv|m\_nlist|
|00002af0| 7d 2c 0a 61 6e 64 20 7b | 5c 65 6d 20 6b 76 6d 5c |},.and {|\em kvm\|
|00002b00| 5f 72 65 61 64 7d 20 74 | 6f 20 61 63 63 65 73 73 |_read} t|o access|
|00002b10| 20 6b 65 72 6e 65 6c 20 | 64 61 74 61 20 73 74 72 | kernel |data str|
|00002b20| 75 63 74 75 72 65 73 20 | 64 69 72 65 63 74 6c 79 |uctures |directly|
|00002b30| 20 76 69 61 0a 74 68 65 | 20 7b 5c 65 6d 20 2f 64 | via.the| {\em /d|
|00002b40| 65 76 2f 6b 6d 65 6d 7d | 20 64 65 76 69 63 65 2e |ev/kmem}| device.|
|00002b50| 20 49 6e 20 67 65 6e 65 | 72 61 6c 2c 20 74 68 65 | In gene|ral, the|
|00002b60| 73 65 20 70 72 6f 67 72 | 61 6d 73 20 77 69 6c 6c |se progr|ams will|
|00002b70| 20 6f 70 65 6e 20 0a 7b | 5c 65 6d 20 2f 64 65 76 | open .{|\em /dev|
|00002b80| 2f 6b 6d 65 6d 7d 2c 20 | 72 65 61 64 20 74 68 65 |/kmem}, |read the|
|00002b90| 20 6b 65 72 6e 65 6c 27 | 73 20 73 79 6d 62 6f 6c | kernel'|s symbol|
|00002ba0| 20 74 61 62 6c 65 2c 20 | 6c 6f 63 61 74 65 20 64 | table, |locate d|
|00002bb0| 61 74 61 20 0a 69 6e 20 | 74 68 65 20 72 75 6e 6e |ata .in |the runn|
|00002bc0| 69 6e 67 20 6b 65 72 6e | 65 6c 20 77 69 74 68 20 |ing kern|el with |
|00002bd0| 74 68 69 73 20 74 61 62 | 6c 65 2c 20 61 6e 64 20 |this tab|le, and |
|00002be0| 72 65 61 64 20 74 68 65 | 20 61 70 70 72 6f 70 72 |read the| appropr|
|00002bf0| 69 61 74 65 20 0a 61 64 | 64 72 65 73 73 65 73 20 |iate .ad|dresses |
|00002c00| 69 6e 20 74 68 65 20 6b | 65 72 6e 65 6c 20 61 64 |in the k|ernel ad|
|00002c10| 64 72 65 73 73 20 73 70 | 61 63 65 20 77 69 74 68 |dress sp|ace with|
|00002c20| 20 74 68 65 73 65 20 72 | 6f 75 74 69 6e 65 73 2e | these r|outines.|
|00002c30| 20 42 65 63 61 75 73 65 | 0a 74 68 69 73 20 72 65 | Because|.this re|
|00002c40| 71 75 69 72 65 73 20 74 | 68 65 20 75 73 65 72 20 |quires t|he user |
|00002c50| 70 72 6f 67 72 61 6d 20 | 61 6e 64 20 74 68 65 20 |program |and the |
|00002c60| 6b 65 72 6e 65 6c 20 74 | 6f 20 61 67 72 65 65 20 |kernel t|o agree |
|00002c70| 75 70 6f 6e 20 74 68 65 | 20 73 69 7a 65 0a 61 6e |upon the| size.an|
|00002c80| 64 20 66 6f 72 6d 61 74 | 20 6f 66 20 64 61 74 61 |d format| of data|
|00002c90| 20 73 74 72 75 63 74 75 | 72 65 73 20 72 65 61 64 | structu|res read|
|00002ca0| 20 69 6e 20 74 68 69 73 | 20 66 61 73 68 69 6f 6e | in this| fashion|
|00002cb0| 2c 20 73 75 63 68 20 70 | 72 6f 67 72 61 6d 73 0a |, such p|rograms.|
|00002cc0| 6f 66 74 65 6e 20 68 61 | 76 65 20 74 6f 20 62 65 |often ha|ve to be|
|00002cd0| 20 72 65 62 75 69 6c 74 | 20 66 6f 72 20 65 61 63 | rebuilt| for eac|
|00002ce0| 68 20 6b 65 72 6e 65 6c | 20 72 65 76 69 73 69 6f |h kernel| revisio|
|00002cf0| 6e 2c 20 43 50 55 20 74 | 79 70 65 2c 20 61 6e 64 |n, CPU t|ype, and|
|00002d00| 20 73 6f 0a 66 6f 72 74 | 68 2e 20 0a 0a 5c 73 75 | so.fort|h. ..\su|
|00002d10| 62 73 65 63 74 69 6f 6e | 7b 7b 5c 65 6d 20 70 74 |bsection|{{\em pt|
|00002d20| 72 61 63 65 7d 20 61 6e | 64 20 74 68 65 20 7b 5c |race} an|d the {\|
|00002d30| 65 6d 20 2f 70 72 6f 63 | 7d 20 66 69 6c 65 73 79 |em /proc|} filesy|
|00002d40| 73 74 65 6d 7d 0a 0a 54 | 68 65 20 7b 5c 65 6d 20 |stem}..T|he {\em |
|00002d50| 70 74 72 61 63 65 7d 20 | 73 79 73 74 65 6d 20 63 |ptrace} |system c|
|00002d60| 61 6c 6c 20 69 73 20 75 | 73 65 64 20 69 6e 20 34 |all is u|sed in 4|
|00002d70| 2e 33 42 53 44 20 61 6e | 64 20 53 56 49 44 20 74 |.3BSD an|d SVID t|
|00002d80| 6f 20 63 6f 6e 74 72 6f | 6c 20 0a 61 20 70 72 6f |o contro|l .a pro|
|00002d90| 63 65 73 73 20 61 6e 64 | 20 72 65 61 64 20 69 6e |cess and| read in|
|00002da0| 66 6f 72 6d 61 74 69 6f | 6e 20 66 72 6f 6d 20 69 |formatio|n from i|
|00002db0| 74 2e 20 49 74 20 69 73 | 20 63 6c 61 73 73 69 63 |t. It is| classic|
|00002dc0| 61 6c 6c 79 20 75 73 65 | 64 20 62 79 20 0a 64 65 |ally use|d by .de|
|00002dd0| 62 75 67 67 65 72 73 20 | 74 6f 2c 20 73 61 79 2c |buggers |to, say,|
|00002de0| 20 74 72 61 70 20 65 78 | 65 63 75 74 69 6f 6e 20 | trap ex|ecution |
|00002df0| 6f 66 20 61 20 72 75 6e | 6e 69 6e 67 20 70 72 6f |of a run|ning pro|
|00002e00| 63 65 73 73 20 6f 72 20 | 65 78 61 6d 69 6e 65 0a |cess or |examine.|
|00002e10| 69 74 73 20 73 74 61 74 | 65 2e 20 55 6e 64 65 72 |its stat|e. Under|
|00002e20| 20 53 56 52 34 2c 20 7b | 5c 65 6d 20 70 74 72 61 | SVR4, {|\em ptra|
|00002e30| 63 65 7d 20 69 73 20 73 | 75 70 65 72 73 65 64 65 |ce} is s|upersede|
|00002e40| 64 20 62 79 20 74 68 65 | 20 7b 5c 65 6d 20 2f 70 |d by the| {\em /p|
|00002e50| 72 6f 63 7d 0a 66 69 6c | 65 73 79 73 74 65 6d 2c |roc}.fil|esystem,|
|00002e60| 20 77 68 69 63 68 20 61 | 70 70 65 61 72 73 20 61 | which a|ppears a|
|00002e70| 73 20 61 20 64 69 72 65 | 63 74 6f 72 79 20 63 6f |s a dire|ctory co|
|00002e80| 6e 74 61 69 6e 69 6e 67 | 20 61 20 73 69 6e 67 6c |ntaining| a singl|
|00002e90| 65 0a 66 69 6c 65 20 65 | 6e 74 72 79 20 66 6f 72 |e.file e|ntry for|
|00002ea0| 20 65 61 63 68 20 72 75 | 6e 6e 69 6e 67 20 70 72 | each ru|nning pr|
|00002eb0| 6f 63 65 73 73 2c 20 6e | 61 6d 65 64 20 62 79 20 |ocess, n|amed by |
|00002ec0| 70 72 6f 63 65 73 73 20 | 49 44 2e 20 54 68 65 20 |process |ID. The |
|00002ed0| 75 73 65 72 0a 70 72 6f | 67 72 61 6d 20 63 61 6e |user.pro|gram can|
|00002ee0| 20 6f 70 65 6e 20 74 68 | 65 20 66 69 6c 65 20 63 | open th|e file c|
|00002ef0| 6f 72 72 65 73 70 6f 6e | 64 69 6e 67 20 74 6f 20 |orrespon|ding to |
|00002f00| 74 68 65 20 70 72 6f 63 | 65 73 73 20 6f 66 20 69 |the proc|ess of i|
|00002f10| 6e 74 65 72 65 73 74 0a | 61 6e 64 20 69 73 73 75 |nterest.|and issu|
|00002f20| 65 20 76 61 72 69 6f 75 | 73 20 7b 5c 65 6d 20 69 |e variou|s {\em i|
|00002f30| 6f 63 74 6c 7d 20 63 61 | 6c 6c 73 20 6f 6e 20 69 |octl} ca|lls on i|
|00002f40| 74 20 74 6f 20 63 6f 6e | 74 72 6f 6c 20 69 74 73 |t to con|trol its|
|00002f50| 20 65 78 65 63 75 74 69 | 6f 6e 0a 6f 72 20 6f 62 | executi|on.or ob|
|00002f60| 74 61 69 6e 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |tain inf|ormation|
|00002f70| 20 66 72 6f 6d 20 74 68 | 65 20 6b 65 72 6e 65 6c | from th|e kernel|
|00002f80| 20 6f 6e 20 74 68 65 20 | 70 72 6f 63 65 73 73 2e | on the |process.|
|00002f90| 20 53 69 6d 69 6c 61 72 | 6c 79 2c 0a 74 68 65 20 | Similar|ly,.the |
|00002fa0| 70 72 6f 67 72 61 6d 20 | 63 61 6e 20 72 65 61 64 |program |can read|
|00002fb0| 20 6f 72 20 77 72 69 74 | 65 20 64 61 74 61 20 64 | or writ|e data d|
|00002fc0| 69 72 65 63 74 6c 79 20 | 69 6e 20 74 68 65 20 70 |irectly |in the p|
|00002fd0| 72 6f 63 65 73 73 27 73 | 20 0a 61 64 64 72 65 73 |rocess's| .addres|
|00002fe0| 73 20 73 70 61 63 65 20 | 74 68 72 6f 75 67 68 20 |s space |through |
|00002ff0| 74 68 65 20 66 69 6c 65 | 20 64 65 73 63 72 69 70 |the file| descrip|
|00003000| 74 6f 72 20 69 6e 74 6f | 20 74 68 65 20 7b 5c 65 |tor into| the {\e|
|00003010| 6d 20 2f 70 72 6f 63 7d | 0a 66 69 6c 65 73 79 73 |m /proc}|.filesys|
|00003020| 74 65 6d 2e 0a 0a 5c 73 | 75 62 73 65 63 74 69 6f |tem...\s|ubsectio|
|00003030| 6e 7b 50 72 6f 63 65 73 | 73 20 63 6f 6e 74 72 6f |n{Proces|s contro|
|00003040| 6c 20 75 6e 64 65 72 20 | 4c 69 6e 75 78 7d 20 0a |l under |Linux} .|
|00003050| 0a 55 6e 64 65 72 20 4c | 69 6e 75 78 2c 20 74 68 |.Under L|inux, th|
|00003060| 65 20 7b 5c 65 6d 20 70 | 74 72 61 63 65 7d 20 73 |e {\em p|trace} s|
|00003070| 79 73 74 65 6d 20 63 61 | 6c 6c 20 69 73 20 73 75 |ystem ca|ll is su|
|00003080| 70 70 6f 72 74 65 64 20 | 66 6f 72 20 70 72 6f 63 |pported |for proc|
|00003090| 65 73 73 0a 63 6f 6e 74 | 72 6f 6c 2c 20 61 6e 64 |ess.cont|rol, and|
|000030a0| 20 69 74 20 77 6f 72 6b | 73 20 61 73 20 69 6e 20 | it work|s as in |
|000030b0| 34 2e 33 42 53 44 2e 20 | 54 6f 20 6f 62 74 61 69 |4.3BSD. |To obtai|
|000030c0| 6e 20 70 72 6f 63 65 73 | 73 20 61 6e 64 20 73 79 |n proces|s and sy|
|000030d0| 73 74 65 6d 0a 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |stem.inf|ormation|
|000030e0| 2c 20 4c 69 6e 75 78 20 | 61 6c 73 6f 20 70 72 6f |, Linux |also pro|
|000030f0| 76 69 64 65 73 20 61 20 | 7b 5c 65 6d 20 2f 70 72 |vides a |{\em /pr|
|00003100| 6f 63 7d 20 66 69 6c 65 | 73 79 73 74 65 6d 2c 20 |oc} file|system, |
|00003110| 62 75 74 20 77 69 74 68 | 0a 76 65 72 79 20 64 69 |but with|.very di|
|00003120| 66 66 65 72 65 6e 74 20 | 73 65 6d 61 6e 74 69 63 |fferent |semantic|
|00003130| 73 2e 20 55 6e 64 65 72 | 20 4c 69 6e 75 78 2c 20 |s. Under| Linux, |
|00003140| 7b 5c 65 6d 20 2f 70 72 | 6f 63 7d 20 63 6f 6e 73 |{\em /pr|oc} cons|
|00003150| 69 73 74 73 20 6f 66 20 | 61 20 0a 6e 75 6d 62 65 |ists of |a .numbe|
|00003160| 72 20 6f 66 20 66 69 6c | 65 73 20 70 72 6f 76 69 |r of fil|es provi|
|00003170| 64 69 6e 67 20 67 65 6e | 65 72 61 6c 20 73 79 73 |ding gen|eral sys|
|00003180| 74 65 6d 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 2c |tem info|rmation,|
|00003190| 20 73 75 63 68 20 61 73 | 0a 6d 65 6d 6f 72 79 20 | such as|.memory |
|000031a0| 75 73 61 67 65 2c 20 6c | 6f 61 64 20 61 76 65 72 |usage, l|oad aver|
|000031b0| 61 67 65 2c 20 6c 6f 61 | 64 65 64 20 6d 6f 64 75 |age, loa|ded modu|
|000031c0| 6c 65 20 73 74 61 74 69 | 73 74 69 63 73 2c 20 61 |le stati|stics, a|
|000031d0| 6e 64 20 6e 65 74 77 6f | 72 6b 0a 73 74 61 74 69 |nd netwo|rk.stati|
|000031e0| 73 74 69 63 73 2e 20 54 | 68 65 73 65 20 66 69 6c |stics. T|hese fil|
|000031f0| 65 73 20 61 72 65 20 67 | 65 6e 65 72 61 6c 6c 79 |es are g|enerally|
|00003200| 20 61 63 63 65 73 73 65 | 64 20 75 73 69 6e 67 20 | accesse|d using |
|00003210| 7b 5c 65 6d 20 72 65 61 | 64 7d 0a 61 6e 64 20 7b |{\em rea|d}.and {|
|00003220| 5c 65 6d 20 77 72 69 74 | 65 7d 20 61 6e 64 20 74 |\em writ|e} and t|
|00003230| 68 65 69 72 20 63 6f 6e | 74 65 6e 74 73 20 63 61 |heir con|tents ca|
|00003240| 6e 20 62 65 20 70 61 72 | 73 65 64 20 75 73 69 6e |n be par|sed usin|
|00003250| 67 20 7b 5c 65 6d 20 73 | 63 61 6e 66 7d 2e 0a 54 |g {\em s|canf}..T|
|00003260| 68 65 20 7b 5c 65 6d 20 | 2f 70 72 6f 63 7d 20 66 |he {\em |/proc} f|
|00003270| 69 6c 65 73 79 73 74 65 | 6d 20 75 6e 64 65 72 20 |ilesyste|m under |
|00003280| 4c 69 6e 75 78 20 61 6c | 73 6f 20 70 72 6f 76 69 |Linux al|so provi|
|00003290| 64 65 73 20 61 20 64 69 | 72 65 63 74 6f 72 79 20 |des a di|rectory |
|000032a0| 0a 65 6e 74 72 79 20 66 | 6f 72 20 65 61 63 68 20 |.entry f|or each |
|000032b0| 72 75 6e 6e 69 6e 67 20 | 70 72 6f 63 65 73 73 2c |running |process,|
|000032c0| 20 6e 61 6d 65 64 20 62 | 79 20 70 72 6f 63 65 73 | named b|y proces|
|000032d0| 73 20 49 44 2c 20 77 68 | 69 63 68 0a 63 6f 6e 74 |s ID, wh|ich.cont|
|000032e0| 61 69 6e 73 20 66 69 6c | 65 20 65 6e 74 72 69 65 |ains fil|e entrie|
|000032f0| 73 20 66 6f 72 20 69 6e | 66 6f 72 6d 61 74 69 6f |s for in|formatio|
|00003300| 6e 20 73 75 63 68 20 61 | 73 20 74 68 65 20 63 6f |n such a|s the co|
|00003310| 6d 6d 61 6e 64 20 6c 69 | 6e 65 2c 20 6c 69 6e 6b |mmand li|ne, link|
|00003320| 73 0a 74 6f 20 74 68 65 | 20 63 75 72 72 65 6e 74 |s.to the| current|
|00003330| 20 77 6f 72 6b 69 6e 67 | 20 64 69 72 65 63 74 6f | working| directo|
|00003340| 72 79 20 61 6e 64 20 65 | 78 65 63 75 74 61 62 6c |ry and e|xecutabl|
|00003350| 65 20 66 69 6c 65 2c 20 | 6f 70 65 6e 20 66 69 6c |e file, |open fil|
|00003360| 65 0a 64 65 73 63 72 69 | 70 74 6f 72 73 2c 20 61 |e.descri|ptors, a|
|00003370| 6e 64 20 73 6f 20 66 6f | 72 74 68 2e 20 54 68 65 |nd so fo|rth. The|
|00003380| 20 6b 65 72 6e 65 6c 20 | 70 72 6f 76 69 64 65 73 | kernel |provides|
|00003390| 20 61 6c 6c 20 6f 66 20 | 74 68 69 73 20 69 6e 66 | all of |this inf|
|000033a0| 6f 72 6d 61 74 69 6f 6e | 0a 6f 6e 20 74 68 65 20 |ormation|.on the |
|000033b0| 66 6c 79 20 69 6e 20 72 | 65 73 70 6f 6e 73 65 20 |fly in r|esponse |
|000033c0| 74 6f 20 7b 5c 65 6d 20 | 72 65 61 64 7d 20 72 65 |to {\em |read} re|
|000033d0| 71 75 65 73 74 73 2e 20 | 54 68 69 73 20 69 6d 70 |quests. |This imp|
|000033e0| 6c 65 6d 65 6e 74 61 74 | 69 6f 6e 0a 69 73 20 6e |lementat|ion.is n|
|000033f0| 6f 74 20 75 6e 6c 69 6b | 65 20 74 68 65 20 7b 5c |ot unlik|e the {\|
|00003400| 65 6d 20 2f 70 72 6f 63 | 7d 20 66 69 6c 65 73 79 |em /proc|} filesy|
|00003410| 73 74 65 6d 20 66 6f 75 | 6e 64 20 69 6e 20 50 6c |stem fou|nd in Pl|
|00003420| 61 6e 20 39 2c 20 62 75 | 74 20 69 74 0a 64 6f 65 |an 9, bu|t it.doe|
|00003430| 73 20 68 61 76 65 20 69 | 74 73 20 64 72 61 77 62 |s have i|ts drawb|
|00003440| 61 63 6b 73 2d 2d 2d 66 | 6f 72 20 65 78 61 6d 70 |acks---f|or examp|
|00003450| 6c 65 2c 20 66 6f 72 20 | 61 20 74 6f 6f 6c 20 73 |le, for |a tool s|
|00003460| 75 63 68 20 61 73 20 7b | 5c 65 6d 20 70 73 7d 0a |uch as {|\em ps}.|
|00003470| 74 6f 20 6c 69 73 74 20 | 61 20 74 61 62 6c 65 20 |to list |a table |
|00003480| 6f 66 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 6f |of infor|mation o|
|00003490| 6e 20 61 6c 6c 20 72 75 | 6e 6e 69 6e 67 20 70 72 |n all ru|nning pr|
|000034a0| 6f 63 65 73 73 65 73 2c | 20 6d 61 6e 79 0a 64 69 |ocesses,| many.di|
|000034b0| 72 65 63 74 6f 72 69 65 | 73 20 6d 75 73 74 20 62 |rectorie|s must b|
|000034c0| 65 20 74 72 61 76 65 72 | 73 65 64 20 61 6e 64 20 |e traver|sed and |
|000034d0| 6d 61 6e 79 20 66 69 6c | 65 73 20 6f 70 65 6e 65 |many fil|es opene|
|000034e0| 64 20 61 6e 64 20 72 65 | 61 64 2e 20 0a 42 79 20 |d and re|ad. .By |
|000034f0| 63 6f 6d 70 61 72 69 73 | 6f 6e 2c 20 74 68 65 20 |comparis|on, the |
|00003500| 7b 5c 65 6d 20 6b 76 6d | 7d 20 72 6f 75 74 69 6e |{\em kvm|} routin|
|00003510| 65 73 20 75 73 65 64 20 | 6f 6e 20 6f 74 68 65 72 |es used |on other|
|00003520| 20 55 4e 49 58 20 73 79 | 73 74 65 6d 73 0a 72 65 | UNIX sy|stems.re|
|00003530| 61 64 20 6b 65 72 6e 65 | 6c 20 64 61 74 61 20 73 |ad kerne|l data s|
|00003540| 74 72 75 63 74 75 72 65 | 73 20 64 69 72 65 63 74 |tructure|s direct|
|00003550| 6c 79 20 77 69 74 68 20 | 6f 6e 6c 79 20 61 20 66 |ly with |only a f|
|00003560| 65 77 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 73 2e |ew syste|m calls.|
|00003570| 0a 0a 4f 62 76 69 6f 75 | 73 6c 79 2c 20 65 61 63 |..Obviou|sly, eac|
|00003580| 68 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |h implem|entation|
|00003590| 20 69 73 20 73 6f 20 76 | 61 73 74 6c 79 20 64 69 | is so v|astly di|
|000035a0| 66 66 65 72 65 6e 74 20 | 74 68 61 74 20 70 6f 72 |fferent |that por|
|000035b0| 74 69 6e 67 0a 61 70 70 | 6c 69 63 61 74 69 6f 6e |ting.app|lication|
|000035c0| 73 20 77 68 69 63 68 20 | 75 73 65 20 74 68 65 6d |s which |use them|
|000035d0| 20 63 61 6e 20 70 72 6f | 76 65 20 74 6f 20 62 65 | can pro|ve to be|
|000035e0| 20 61 20 72 65 61 6c 20 | 74 61 73 6b 2e 20 49 74 | a real |task. It|
|000035f0| 20 73 68 6f 75 6c 64 0a | 62 65 20 70 6f 69 6e 74 | should.|be point|
|00003600| 65 64 20 6f 75 74 20 74 | 68 61 74 20 74 68 65 20 |ed out t|hat the |
|00003610| 53 56 52 34 20 7b 5c 65 | 6d 20 2f 70 72 6f 63 7d |SVR4 {\e|m /proc}|
|00003620| 20 66 69 6c 65 73 79 73 | 74 65 6d 20 69 73 20 61 | filesys|tem is a|
|00003630| 20 76 65 72 79 0a 64 69 | 66 66 65 72 65 6e 74 20 | very.di|fferent |
|00003640| 62 65 61 73 74 20 74 68 | 61 6e 20 74 68 61 74 20 |beast th|an that |
|00003650| 66 6f 75 6e 64 20 69 6e | 20 4c 69 6e 75 78 2c 20 |found in| Linux, |
|00003660| 61 6e 64 20 74 68 65 79 | 20 6d 61 79 20 6e 6f 74 |and they| may not|
|00003670| 20 62 65 20 75 73 65 64 | 0a 69 6e 20 74 68 65 20 | be used|.in the |
|00003680| 73 61 6d 65 20 63 6f 6e | 74 65 78 74 2e 20 41 72 |same con|text. Ar|
|00003690| 67 75 61 62 6c 79 2c 20 | 61 6e 79 20 70 72 6f 67 |guably, |any prog|
|000036a0| 72 61 6d 20 77 68 69 63 | 68 20 75 73 65 73 20 74 |ram whic|h uses t|
|000036b0| 68 65 20 7b 5c 65 6d 20 | 6b 76 6d 7d 0a 72 6f 75 |he {\em |kvm}.rou|
|000036c0| 74 69 6e 65 73 20 6f 72 | 20 53 56 52 34 20 7b 5c |tines or| SVR4 {\|
|000036d0| 65 6d 20 2f 70 72 6f 63 | 7d 20 66 69 6c 65 73 79 |em /proc|} filesy|
|000036e0| 73 74 65 6d 20 69 73 20 | 6e 6f 74 20 72 65 61 6c |stem is |not real|
|000036f0| 6c 79 20 70 6f 72 74 61 | 62 6c 65 2c 20 61 6e 64 |ly porta|ble, and|
|00003700| 0a 74 68 6f 73 65 20 73 | 65 63 74 69 6f 6e 73 20 |.those s|ections |
|00003710| 6f 66 20 63 6f 64 65 20 | 73 68 6f 75 6c 64 20 62 |of code |should b|
|00003720| 65 20 72 65 77 72 69 74 | 74 65 6e 20 66 6f 72 20 |e rewrit|ten for |
|00003730| 65 61 63 68 20 6f 70 65 | 72 61 74 69 6e 67 20 73 |each ope|rating s|
|00003740| 79 73 74 65 6d 2e 0a 0a | 54 68 65 20 4c 69 6e 75 |ystem...|The Linu|
|00003750| 78 20 7b 5c 65 6d 20 70 | 74 72 61 63 65 7d 20 63 |x {\em p|trace} c|
|00003760| 61 6c 6c 20 69 73 20 6e | 65 61 72 6c 79 20 69 64 |all is n|early id|
|00003770| 65 6e 74 69 63 61 6c 20 | 74 6f 20 74 68 61 74 20 |entical |to that |
|00003780| 66 6f 75 6e 64 20 69 6e | 20 42 53 44 2c 0a 62 75 |found in| BSD,.bu|
|00003790| 74 20 74 68 65 72 65 20 | 61 72 65 20 61 20 66 65 |t there |are a fe|
|000037a0| 77 20 64 69 66 66 65 72 | 65 6e 63 65 73 3a 0a 5c |w differ|ences:.\|
|000037b0| 62 65 67 69 6e 7b 69 74 | 65 6d 69 7a 65 7d 0a 5c |begin{it|emize}.\|
|000037c0| 69 74 65 6d 20 54 68 65 | 20 72 65 71 75 65 73 74 |item The| request|
|000037d0| 73 20 7b 5c 74 74 20 50 | 54 52 41 43 45 5c 5f 50 |s {\tt P|TRACE\_P|
|000037e0| 45 45 4b 55 53 45 52 7d | 20 61 6e 64 20 7b 5c 74 |EEKUSER}| and {\t|
|000037f0| 74 20 50 54 52 41 43 45 | 5c 5f 50 4f 4b 45 55 53 |t PTRACE|\_POKEUS|
|00003800| 45 52 7d 20 75 6e 64 65 | 72 0a 42 53 44 20 61 72 |ER} unde|r.BSD ar|
|00003810| 65 20 6e 61 6d 65 64 20 | 7b 5c 74 74 20 50 54 52 |e named |{\tt PTR|
|00003820| 41 43 45 5c 5f 50 45 45 | 4b 55 53 52 7d 20 61 6e |ACE\_PEE|KUSR} an|
|00003830| 64 20 7b 5c 74 74 20 50 | 54 52 41 43 45 5c 5f 50 |d {\tt P|TRACE\_P|
|00003840| 4f 4b 45 55 53 52 7d 2c | 20 72 65 73 70 65 63 74 |OKEUSR},| respect|
|00003850| 69 76 65 6c 79 2c 0a 75 | 6e 64 65 72 20 4c 69 6e |ively,.u|nder Lin|
|00003860| 75 78 2e 0a 5c 69 74 65 | 6d 20 50 72 6f 63 65 73 |ux..\ite|m Proces|
|00003870| 73 20 72 65 67 69 73 74 | 65 72 73 20 63 61 6e 20 |s regist|ers can |
|00003880| 62 65 20 73 65 74 20 75 | 73 69 6e 67 20 74 68 65 |be set u|sing the|
|00003890| 20 7b 5c 74 74 20 50 54 | 52 41 43 45 5c 5f 50 4f | {\tt PT|RACE\_PO|
|000038a0| 4b 45 55 53 52 7d 20 72 | 65 71 75 65 73 74 0a 77 |KEUSR} r|equest.w|
|000038b0| 69 74 68 20 6f 66 66 73 | 65 74 73 20 66 6f 75 6e |ith offs|ets foun|
|000038c0| 64 20 69 6e 20 7b 5c 74 | 74 20 20 2f 75 73 72 2f |d in {\t|t /usr/|
|000038d0| 69 6e 63 6c 75 64 65 2f | 6c 69 6e 75 78 2f 70 74 |include/|linux/pt|
|000038e0| 72 61 63 65 2e 68 7d 2e | 0a 5c 69 74 65 6d 20 54 |race.h}.|.\item T|
|000038f0| 68 65 20 53 75 6e 4f 53 | 20 72 65 71 75 65 73 74 |he SunOS| request|
|00003900| 73 20 7b 5c 74 74 20 50 | 54 52 41 43 45 5c 5f 5c |s {\tt P|TRACE\_\|
|00003910| 7b 52 45 41 44 2c 57 52 | 49 54 45 5c 7d 5c 7b 54 |{READ,WR|ITE\}\{T|
|00003920| 45 58 54 2c 44 41 54 41 | 5c 7d 7d 20 61 72 65 0a |EXT,DATA|\}} are.|
|00003930| 6e 6f 74 20 73 75 70 70 | 6f 72 74 65 64 2c 20 6e |not supp|orted, n|
|00003940| 6f 72 20 61 72 65 20 7b | 5c 74 74 20 50 54 52 41 |or are {|\tt PTRA|
|00003950| 43 45 5c 5f 53 45 54 41 | 43 42 4b 50 54 7d 2c 20 |CE\_SETA|CBKPT}, |
|00003960| 7b 5c 74 74 20 50 54 52 | 41 43 45 5c 5f 53 45 54 |{\tt PTR|ACE\_SET|
|00003970| 57 52 42 4b 50 54 7d 2c | 0a 7b 5c 74 74 20 50 54 |WRBKPT},|.{\tt PT|
|00003980| 52 41 43 45 5c 5f 43 4c | 52 42 4b 50 54 7d 2c 20 |RACE\_CL|RBKPT}, |
|00003990| 6f 72 20 7b 5c 74 74 20 | 50 54 52 41 43 45 5c 5f |or {\tt |PTRACE\_|
|000039a0| 44 55 4d 50 43 4f 52 45 | 7d 2e 0a 54 68 65 73 65 |DUMPCORE|}..These|
|000039b0| 20 6d 69 73 73 69 6e 67 | 20 72 65 71 75 65 73 74 | missing| request|
|000039c0| 73 20 73 68 6f 75 6c 64 | 20 6f 6e 6c 79 20 61 66 |s should| only af|
|000039d0| 66 65 63 74 20 61 20 73 | 6d 61 6c 6c 20 6e 75 6d |fect a s|mall num|
|000039e0| 62 65 72 20 6f 66 20 65 | 78 69 73 74 69 6e 67 0a |ber of e|xisting.|
|000039f0| 70 72 6f 67 72 61 6d 73 | 2e 0a 5c 65 6e 64 7b 69 |programs|..\end{i|
|00003a00| 74 65 6d 69 7a 65 7d 0a | 0a 4c 69 6e 75 78 20 64 |temize}.|.Linux d|
|00003a10| 6f 65 73 20 7b 5c 65 6d | 20 6e 6f 74 7d 20 70 72 |oes {\em| not} pr|
|00003a20| 6f 76 69 64 65 20 74 68 | 65 20 7b 5c 65 6d 20 6b |ovide th|e {\em k|
|00003a30| 76 6d 7d 20 72 6f 75 74 | 69 6e 65 73 20 66 6f 72 |vm} rout|ines for|
|00003a40| 20 72 65 61 64 69 6e 67 | 20 74 68 65 0a 6b 65 72 | reading| the.ker|
|00003a50| 6e 65 6c 20 61 64 64 72 | 65 73 73 20 73 70 61 63 |nel addr|ess spac|
|00003a60| 65 20 66 72 6f 6d 20 61 | 20 75 73 65 72 20 70 72 |e from a| user pr|
|00003a70| 6f 67 72 61 6d 2c 20 62 | 75 74 20 73 6f 6d 65 20 |ogram, b|ut some |
|00003a80| 70 72 6f 67 72 61 6d 73 | 20 28 6d 6f 73 74 0a 6e |programs| (most.n|
|00003a90| 6f 74 61 62 6c 79 20 7b | 5c 65 6d 20 6b 6d 65 6d |otably {|\em kmem|
|00003aa0| 5c 5f 70 73 7d 29 20 69 | 6d 70 6c 65 6d 65 6e 74 |\_ps}) i|mplement|
|00003ab0| 20 74 68 65 69 72 20 6f | 77 6e 20 76 65 72 73 69 | their o|wn versi|
|00003ac0| 6f 6e 73 20 6f 66 20 74 | 68 65 73 65 20 72 6f 75 |ons of t|hese rou|
|00003ad0| 74 69 6e 65 73 2e 0a 49 | 6e 20 67 65 6e 65 72 61 |tines..I|n genera|
|00003ae0| 6c 2c 20 74 68 65 73 65 | 20 61 72 65 20 6e 6f 74 |l, these| are not|
|00003af0| 20 70 6f 72 74 61 62 6c | 65 2c 20 61 6e 64 20 61 | portabl|e, and a|
|00003b00| 6e 79 20 63 6f 64 65 20 | 77 68 69 63 68 20 75 73 |ny code |which us|
|00003b10| 65 73 20 74 68 65 20 0a | 7b 5c 65 6d 20 6b 76 6d |es the .|{\em kvm|
|00003b20| 7d 20 72 6f 75 74 69 6e | 65 73 20 69 73 20 70 72 |} routin|es is pr|
|00003b30| 6f 62 61 62 6c 79 20 64 | 65 70 65 6e 64 69 6e 67 |obably d|epending|
|00003b40| 20 75 70 6f 6e 20 74 68 | 65 20 61 76 61 69 6c 61 | upon th|e availa|
|00003b50| 62 69 6c 69 74 79 20 6f | 66 0a 63 65 72 74 61 69 |bility o|f.certai|
|00003b60| 6e 20 73 79 6d 62 6f 6c | 73 20 6f 72 20 64 61 74 |n symbol|s or dat|
|00003b70| 61 20 73 74 72 75 63 74 | 75 72 65 73 20 69 6e 20 |a struct|ures in |
|00003b80| 74 68 65 20 6b 65 72 6e | 65 6c 2d 2d 2d 6e 6f 74 |the kern|el---not|
|00003b90| 20 61 20 73 61 66 65 20 | 61 73 73 75 6d 70 74 69 | a safe |assumpti|
|00003ba0| 6f 6e 0a 74 6f 20 6d 61 | 6b 65 2e 20 55 73 65 20 |on.to ma|ke. Use |
|00003bb0| 6f 66 20 7b 5c 65 6d 20 | 6b 76 6d 7d 20 72 6f 75 |of {\em |kvm} rou|
|00003bc0| 74 69 6e 65 73 20 73 68 | 6f 75 6c 64 20 62 65 20 |tines sh|ould be |
|00003bd0| 63 6f 6e 73 69 64 65 72 | 65 64 20 61 72 63 68 69 |consider|ed archi|
|00003be0| 74 65 63 74 75 72 65 2d | 73 70 65 63 69 66 69 63 |tecture-|specific|
|00003bf0| 2e 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 50 6f 72 74 |...\sect|ion{Port|
|00003c00| 61 62 6c 65 20 63 6f 6e | 64 69 74 69 6f 6e 61 6c |able con|ditional|
|00003c10| 20 63 6f 6d 70 69 6c 61 | 74 69 6f 6e 7d 0a 0a 49 | compila|tion}..I|
|00003c20| 66 20 79 6f 75 20 6e 65 | 65 64 20 74 6f 20 6d 61 |f you ne|ed to ma|
|00003c30| 6b 65 20 6d 6f 64 69 66 | 69 63 61 74 69 6f 6e 73 |ke modif|ications|
|00003c40| 20 74 6f 20 65 78 69 73 | 74 69 6e 67 20 63 6f 64 | to exis|ting cod|
|00003c50| 65 20 69 6e 20 6f 72 64 | 65 72 20 74 6f 20 70 6f |e in ord|er to po|
|00003c60| 72 74 0a 69 74 20 74 6f | 20 4c 69 6e 75 78 2c 20 |rt.it to| Linux, |
|00003c70| 79 6f 75 20 6d 61 79 20 | 6e 65 65 64 20 74 6f 20 |you may |need to |
|00003c80| 75 73 65 20 7b 5c 74 74 | 20 69 66 64 65 66 7d 5c |use {\tt| ifdef}\|
|00003c90| 6c 64 6f 74 73 20 7b 5c | 74 74 20 65 6e 64 69 66 |ldots {\|tt endif|
|00003ca0| 7d 20 70 61 69 72 73 0a | 74 6f 20 73 75 72 72 6f |} pairs.|to surro|
|00003cb0| 75 6e 64 20 70 61 72 74 | 73 20 6f 66 20 4c 69 6e |und part|s of Lin|
|00003cc0| 75 78 2d 73 70 65 63 69 | 66 69 63 20 63 6f 64 65 |ux-speci|fic code|
|00003cd0| 2d 2d 2d 6f 72 2c 20 66 | 6f 72 20 74 68 61 74 20 |---or, f|or that |
|00003ce0| 6d 61 74 74 65 72 2c 20 | 63 6f 64 65 0a 63 6f 72 |matter, |code.cor|
|00003cf0| 72 65 73 70 6f 6e 64 69 | 6e 67 20 74 6f 20 6f 74 |respondi|ng to ot|
|00003d00| 68 65 72 20 69 6d 70 6c | 65 6d 65 6e 74 61 74 69 |her impl|ementati|
|00003d10| 6f 6e 73 2e 20 4e 6f 20 | 72 65 61 6c 20 73 74 61 |ons. No |real sta|
|00003d20| 6e 64 61 72 64 20 66 6f | 72 20 73 65 6c 65 63 74 |ndard fo|r select|
|00003d30| 69 6e 67 0a 70 6f 72 74 | 69 6f 6e 73 20 6f 66 20 |ing.port|ions of |
|00003d40| 63 6f 64 65 20 74 6f 20 | 62 65 20 63 6f 6d 70 69 |code to |be compi|
|00003d50| 6c 65 64 20 62 61 73 65 | 64 20 6f 6e 20 74 68 65 |led base|d on the|
|00003d60| 20 6f 70 65 72 61 74 69 | 6e 67 20 73 79 73 74 65 | operati|ng syste|
|00003d70| 6d 20 65 78 69 73 74 73 | 2c 0a 62 75 74 20 6d 61 |m exists|,.but ma|
|00003d80| 6e 79 20 70 72 6f 67 72 | 61 6d 73 20 75 73 65 20 |ny progr|ams use |
|00003d90| 61 20 63 6f 6e 76 65 6e | 74 69 6f 6e 20 73 75 63 |a conven|tion suc|
|00003da0| 68 20 61 73 20 64 65 66 | 69 6e 69 6e 67 20 7b 5c |h as def|ining {\|
|00003db0| 74 74 20 53 56 52 34 7d | 20 66 6f 72 20 53 79 73 |tt SVR4}| for Sys|
|00003dc0| 74 65 6d 0a 56 20 63 6f | 64 65 2c 20 7b 5c 74 74 |tem.V co|de, {\tt|
|00003dd0| 20 42 53 44 7d 20 66 6f | 72 20 42 53 44 20 63 6f | BSD} fo|r BSD co|
|00003de0| 64 65 2c 20 61 6e 64 20 | 7b 5c 74 74 20 6c 69 6e |de, and |{\tt lin|
|00003df0| 75 78 7d 20 66 6f 72 20 | 4c 69 6e 75 78 2d 73 70 |ux} for |Linux-sp|
|00003e00| 65 63 69 66 69 63 20 63 | 6f 64 65 2e 0a 0a 54 68 |ecific c|ode...Th|
|00003e10| 65 20 47 4e 55 20 43 20 | 6c 69 62 72 61 72 79 20 |e GNU C |library |
|00003e20| 75 73 65 64 20 62 79 20 | 4c 69 6e 75 78 20 61 6c |used by |Linux al|
|00003e30| 6c 6f 77 73 20 79 6f 75 | 20 74 6f 20 74 75 72 6e |lows you| to turn|
|00003e40| 20 6f 6e 20 76 61 72 69 | 6f 75 73 20 66 65 61 74 | on vari|ous feat|
|00003e50| 75 72 65 73 0a 6f 66 20 | 74 68 65 20 6c 69 62 72 |ures.of |the libr|
|00003e60| 61 72 79 20 62 79 20 64 | 65 66 69 6e 69 6e 67 20 |ary by d|efining |
|00003e70| 76 61 72 69 6f 75 73 20 | 6d 61 63 72 6f 73 20 61 |various |macros a|
|00003e80| 74 20 63 6f 6d 70 69 6c | 65 20 74 69 6d 65 2e 20 |t compil|e time. |
|00003e90| 54 68 65 73 65 0a 61 72 | 65 3a 0a 5c 62 65 67 69 |These.ar|e:.\begi|
|00003ea0| 6e 7b 69 74 65 6d 69 7a | 65 7d 0a 5c 69 74 65 6d |n{itemiz|e}.\item|
|00003eb0| 20 7b 5c 74 74 20 5c 5f | 5c 5f 53 54 52 49 43 54 | {\tt \_|\_STRICT|
|00003ec0| 5c 5f 41 4e 53 49 5c 5f | 5c 5f 7d 3a 20 46 6f 72 |\_ANSI\_|\_}: For|
|00003ed0| 20 41 4e 53 49 20 43 20 | 66 65 61 74 75 72 65 73 | ANSI C |features|
|00003ee0| 20 6f 6e 6c 79 0a 5c 69 | 74 65 6d 20 7b 5c 74 74 | only.\i|tem {\tt|
|00003ef0| 20 5c 5f 50 4f 53 49 58 | 5c 5f 53 4f 55 52 43 45 | \_POSIX|\_SOURCE|
|00003f00| 7d 3a 20 46 6f 72 20 50 | 4f 53 49 58 2e 31 20 66 |}: For P|OSIX.1 f|
|00003f10| 65 61 74 75 72 65 73 0a | 5c 69 74 65 6d 20 7b 5c |eatures.|\item {\|
|00003f20| 74 74 20 5c 5f 50 4f 53 | 49 58 5c 5f 43 5c 5f 53 |tt \_POS|IX\_C\_S|
|00003f30| 4f 55 52 43 45 7d 3a 20 | 49 66 20 64 65 66 69 6e |OURCE}: |If defin|
|00003f40| 65 64 20 61 73 20 31 2c | 20 50 4f 53 49 58 2e 31 |ed as 1,| POSIX.1|
|00003f50| 20 66 65 61 74 75 72 65 | 73 3b 0a 69 66 20 64 65 | feature|s;.if de|
|00003f60| 66 69 6e 65 64 20 61 73 | 20 32 2c 20 50 4f 53 49 |fined as| 2, POSI|
|00003f70| 58 2e 32 20 66 65 61 74 | 75 72 65 73 2e 0a 5c 69 |X.2 feat|ures..\i|
|00003f80| 74 65 6d 20 7b 5c 74 74 | 20 5c 5f 42 53 44 5c 5f |tem {\tt| \_BSD\_|
|00003f90| 53 4f 55 52 43 45 7d 3a | 20 41 4e 53 49 2c 20 50 |SOURCE}:| ANSI, P|
|00003fa0| 4f 53 49 58 2c 20 61 6e | 64 20 42 53 44 20 66 65 |OSIX, an|d BSD fe|
|00003fb0| 61 74 75 72 65 73 2e 0a | 5c 69 74 65 6d 20 7b 5c |atures..|\item {\|
|00003fc0| 74 74 20 5c 5f 53 56 49 | 44 5c 5f 53 4f 55 52 43 |tt \_SVI|D\_SOURC|
|00003fd0| 45 7d 3a 20 41 4e 53 49 | 2c 20 50 4f 53 49 58 2c |E}: ANSI|, POSIX,|
|00003fe0| 20 61 6e 64 20 53 79 73 | 74 65 6d 20 56 20 66 65 | and Sys|tem V fe|
|00003ff0| 61 74 75 72 65 73 2e 0a | 5c 69 74 65 6d 20 7b 5c |atures..|\item {\|
|00004000| 74 74 20 5c 5f 47 4e 55 | 5c 5f 53 4f 55 52 43 45 |tt \_GNU|\_SOURCE|
|00004010| 7d 3a 20 41 4e 53 49 2c | 20 50 4f 53 49 58 2c 20 |}: ANSI,| POSIX, |
|00004020| 42 53 44 2c 20 53 56 49 | 44 2c 20 61 6e 64 20 47 |BSD, SVI|D, and G|
|00004030| 4e 55 20 65 78 74 65 6e | 73 69 6f 6e 73 2e 0a 54 |NU exten|sions..T|
|00004040| 68 69 73 20 69 73 20 74 | 68 65 20 64 65 66 61 75 |his is t|he defau|
|00004050| 6c 74 20 69 66 20 6e 6f | 6e 65 20 6f 66 20 74 68 |lt if no|ne of th|
|00004060| 65 20 61 62 6f 76 65 20 | 61 72 65 20 64 65 66 69 |e above |are defi|
|00004070| 6e 65 64 2e 0a 5c 65 6e | 64 7b 69 74 65 6d 69 7a |ned..\en|d{itemiz|
|00004080| 65 7d 0a 0a 49 66 20 79 | 6f 75 20 64 65 66 69 6e |e}..If y|ou defin|
|00004090| 65 20 7b 5c 74 74 20 5c | 5f 42 53 44 5c 5f 53 4f |e {\tt \|_BSD\_SO|
|000040a0| 55 52 43 45 7d 20 79 6f | 75 72 73 65 6c 66 2c 20 |URCE} yo|urself, |
|000040b0| 74 68 65 20 61 64 64 69 | 74 69 6f 6e 61 6c 20 64 |the addi|tional d|
|000040c0| 65 66 69 6e 69 74 69 6f | 6e 0a 7b 5c 74 74 20 5c |efinitio|n.{\tt \|
|000040d0| 5f 46 41 56 4f 52 5c 5f | 42 53 44 7d 20 77 69 6c |_FAVOR\_|BSD} wil|
|000040e0| 6c 20 62 65 20 64 65 66 | 69 6e 65 64 20 66 6f 72 |l be def|ined for|
|000040f0| 20 74 68 65 20 6c 69 62 | 72 61 72 79 2e 20 54 68 | the lib|rary. Th|
|00004100| 69 73 20 77 69 6c 6c 0a | 63 61 75 73 65 20 42 53 |is will.|cause BS|
|00004110| 44 20 62 65 68 61 76 69 | 6f 72 20 66 6f 72 20 63 |D behavi|or for c|
|00004120| 65 72 74 61 69 6e 20 74 | 68 69 6e 67 73 20 74 6f |ertain t|hings to|
|00004130| 20 62 65 20 73 65 6c 65 | 63 74 65 64 20 6f 76 65 | be sele|cted ove|
|00004140| 72 20 50 4f 53 49 58 20 | 6f 72 0a 53 56 52 34 2e |r POSIX |or.SVR4.|
|00004150| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 69 66 | For exa|mple, if|
|00004160| 20 7b 5c 74 74 20 5c 5f | 46 41 56 4f 52 5c 5f 42 | {\tt \_|FAVOR\_B|
|00004170| 53 44 7d 20 69 73 20 64 | 65 66 69 6e 65 64 2c 20 |SD} is d|efined, |
|00004180| 7b 5c 65 6d 20 73 65 74 | 6a 6d 70 7d 20 61 6e 64 |{\em set|jmp} and|
|00004190| 0a 7b 5c 65 6d 20 6c 6f | 6e 67 6a 6d 70 7d 20 77 |.{\em lo|ngjmp} w|
|000041a0| 69 6c 6c 20 73 61 76 65 | 20 61 6e 64 20 72 65 73 |ill save| and res|
|000041b0| 74 6f 72 65 20 74 68 65 | 20 73 69 67 6e 61 6c 20 |tore the| signal |
|000041c0| 6d 61 73 6b 2c 20 61 6e | 64 20 7b 5c 65 6d 20 67 |mask, an|d {\em g|
|000041d0| 65 74 70 67 72 70 7d 0a | 77 69 6c 6c 20 61 63 63 |etpgrp}.|will acc|
|000041e0| 65 70 74 20 61 20 50 49 | 44 20 61 72 67 75 6d 65 |ept a PI|D argume|
|000041f0| 6e 74 2e 20 4e 6f 74 65 | 20 74 68 61 74 20 79 6f |nt. Note| that yo|
|00004200| 75 20 6d 75 73 74 20 73 | 74 69 6c 6c 20 6c 69 6e |u must s|till lin|
|00004210| 6b 20 61 67 61 69 6e 73 | 74 0a 7b 5c 74 74 20 6c |k agains|t.{\tt l|
|00004220| 69 62 62 73 64 7d 20 74 | 6f 20 67 65 74 20 42 53 |ibbsd} t|o get BS|
|00004230| 44 2d 6c 69 6b 65 20 62 | 65 68 61 76 69 6f 72 20 |D-like b|ehavior |
|00004240| 66 6f 72 20 74 68 65 20 | 66 65 61 74 75 72 65 73 |for the |features|
|00004250| 20 6d 65 6e 74 69 6f 6e | 65 64 20 0a 65 61 72 6c | mention|ed .earl|
|00004260| 69 65 72 20 69 6e 20 74 | 68 69 73 20 70 61 70 65 |ier in t|his pape|
|00004270| 72 2e 20 0a 0a 55 6e 64 | 65 72 20 4c 69 6e 75 78 |r. ..Und|er Linux|
|00004280| 2c 20 7b 5c 74 74 20 67 | 63 63 7d 20 64 65 66 69 |, {\tt g|cc} defi|
|00004290| 6e 65 73 20 61 20 6e 75 | 6d 62 65 72 20 6f 66 20 |nes a nu|mber of |
|000042a0| 6d 61 63 72 6f 73 20 61 | 75 74 6f 6d 61 74 69 63 |macros a|utomatic|
|000042b0| 61 6c 6c 79 0a 77 68 69 | 63 68 20 79 6f 75 20 63 |ally.whi|ch you c|
|000042c0| 61 6e 20 75 73 65 20 69 | 6e 20 79 6f 75 72 20 70 |an use i|n your p|
|000042d0| 72 6f 67 72 61 6d 2e 20 | 54 68 65 73 65 20 61 72 |rogram. |These ar|
|000042e0| 65 3a 0a 5c 62 65 67 69 | 6e 7b 69 74 65 6d 69 7a |e:.\begi|n{itemiz|
|000042f0| 65 7d 0a 5c 69 74 65 6d | 20 7b 5c 74 74 20 5c 5f |e}.\item| {\tt \_|
|00004300| 5c 5f 47 4e 55 43 5c 5f | 5c 5f 7d 20 28 6d 61 6a |\_GNUC\_|\_} (maj|
|00004310| 6f 72 20 47 4e 55 20 43 | 20 76 65 72 73 69 6f 6e |or GNU C| version|
|00004320| 2c 20 65 2e 67 2e 2c 20 | 32 29 0a 5c 69 74 65 6d |, e.g., |2).\item|
|00004330| 20 7b 5c 74 74 20 5c 5f | 5c 5f 47 4e 55 43 5c 5f | {\tt \_|\_GNUC\_|
|00004340| 4d 49 4e 4f 52 5c 5f 5c | 5f 7d 20 28 6d 69 6e 6f |MINOR\_\|_} (mino|
|00004350| 72 20 47 4e 55 20 43 20 | 76 65 72 73 69 6f 6e 2c |r GNU C |version,|
|00004360| 20 65 2e 67 2e 2c 20 35 | 29 0a 5c 69 74 65 6d 20 | e.g., 5|).\item |
|00004370| 7b 5c 74 74 20 75 6e 69 | 78 7d 0a 5c 69 74 65 6d |{\tt uni|x}.\item|
|00004380| 20 7b 5c 74 74 20 69 33 | 38 36 7d 0a 5c 69 74 65 | {\tt i3|86}.\ite|
|00004390| 6d 20 7b 5c 74 74 20 6c | 69 6e 75 78 7d 0a 5c 69 |m {\tt l|inux}.\i|
|000043a0| 74 65 6d 20 7b 5c 74 74 | 20 5c 5f 5c 5f 75 6e 69 |tem {\tt| \_\_uni|
|000043b0| 78 5c 5f 5c 5f 7d 0a 5c | 69 74 65 6d 20 7b 5c 74 |x\_\_}.\|item {\t|
|000043c0| 74 20 5c 5f 5c 5f 69 33 | 38 36 5c 5f 5c 5f 7d 0a |t \_\_i3|86\_\_}.|
|000043d0| 5c 69 74 65 6d 20 7b 5c | 74 74 20 5c 5f 5c 5f 6c |\item {\|tt \_\_l|
|000043e0| 69 6e 75 78 5c 5f 5c 5f | 7d 0a 5c 69 74 65 6d 20 |inux\_\_|}.\item |
|000043f0| 7b 5c 74 74 20 5c 5f 5c | 5f 75 6e 69 78 7d 0a 5c |{\tt \_\|_unix}.\|
|00004400| 69 74 65 6d 20 7b 5c 74 | 74 20 5c 5f 5c 5f 69 33 |item {\t|t \_\_i3|
|00004410| 38 36 7d 0a 5c 69 74 65 | 6d 20 7b 5c 74 74 20 5c |86}.\ite|m {\tt \|
|00004420| 5f 5c 5f 6c 69 6e 75 78 | 7d 0a 5c 65 6e 64 7b 69 |_\_linux|}.\end{i|
|00004430| 74 65 6d 69 7a 65 7d 0a | 4d 61 6e 79 20 70 72 6f |temize}.|Many pro|
|00004440| 67 72 61 6d 73 20 75 73 | 65 20 0a 5c 62 65 67 69 |grams us|e .\begi|
|00004450| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 20 20 23 69 |n{verbat|im}. #i|
|00004460| 66 64 65 66 20 6c 69 6e | 75 78 0a 5c 65 6e 64 7b |fdef lin|ux.\end{|
|00004470| 76 65 72 62 61 74 69 6d | 7d 20 0a 74 6f 20 73 75 |verbatim|} .to su|
|00004480| 72 72 6f 75 6e 64 20 4c | 69 6e 75 78 2d 73 70 65 |rround L|inux-spe|
|00004490| 63 69 66 69 63 20 63 6f | 64 65 2e 20 55 73 69 6e |cific co|de. Usin|
|000044a0| 67 20 74 68 65 73 65 20 | 63 6f 6d 70 69 6c 65 2d |g these |compile-|
|000044b0| 74 69 6d 65 20 6d 61 63 | 72 6f 73 0a 79 6f 75 20 |time mac|ros.you |
|000044c0| 63 61 6e 20 65 61 73 69 | 6c 79 20 61 64 61 70 74 |can easi|ly adapt|
|000044d0| 20 65 78 69 73 74 69 6e | 67 20 63 6f 64 65 20 74 | existin|g code t|
|000044e0| 6f 20 69 6e 63 6c 75 64 | 65 20 6f 72 20 65 78 63 |o includ|e or exc|
|000044f0| 6c 75 64 65 20 63 68 61 | 6e 67 65 73 0a 6e 65 63 |lude cha|nges.nec|
|00004500| 65 73 73 61 72 79 20 74 | 6f 20 70 6f 72 74 20 74 |essary t|o port t|
|00004510| 68 65 20 70 72 6f 67 72 | 61 6d 20 74 6f 20 4c 69 |he progr|am to Li|
|00004520| 6e 75 78 2c 20 4e 6f 74 | 65 20 74 68 61 74 20 62 |nux, Not|e that b|
|00004530| 65 63 61 75 73 65 20 4c | 69 6e 75 78 0a 73 75 70 |ecause L|inux.sup|
|00004540| 70 6f 72 74 73 20 6d 6f | 72 65 20 53 79 73 74 65 |ports mo|re Syste|
|00004550| 6d 20 56 2d 6c 69 6b 65 | 20 66 65 61 74 75 72 65 |m V-like| feature|
|00004560| 73 20 69 6e 20 67 65 6e | 65 72 61 6c 2c 20 74 68 |s in gen|eral, th|
|00004570| 65 20 62 65 73 74 20 63 | 6f 64 65 0a 62 61 73 65 |e best c|ode.base|
|00004580| 20 74 6f 20 73 74 61 72 | 74 20 66 72 6f 6d 20 77 | to star|t from w|
|00004590| 69 74 68 20 61 20 70 72 | 6f 67 72 61 6d 20 77 72 |ith a pr|ogram wr|
|000045a0| 69 74 74 65 6e 20 66 6f | 72 20 62 6f 74 68 20 53 |itten fo|r both S|
|000045b0| 79 73 74 65 6d 20 56 20 | 61 6e 64 0a 42 53 44 20 |ystem V |and.BSD |
|000045c0| 69 73 20 70 72 6f 62 61 | 62 6c 79 20 74 68 65 20 |is proba|bly the |
|000045d0| 53 79 73 74 65 6d 20 56 | 20 76 65 72 73 69 6f 6e |System V| version|
|000045e0| 2e 20 41 6c 74 65 72 6e | 61 74 65 6c 79 2c 20 79 |. Altern|ately, y|
|000045f0| 6f 75 20 63 61 6e 20 73 | 74 61 72 74 0a 66 72 6f |ou can s|tart.fro|
|00004600| 6d 20 74 68 65 20 42 53 | 44 20 62 61 73 65 20 61 |m the BS|D base a|
|00004610| 6e 64 20 6c 69 6e 6b 20 | 61 67 61 69 6e 73 74 20 |nd link |against |
|00004620| 7b 5c 74 74 20 6c 69 62 | 62 73 64 7d 2e 20 0a 0a |{\tt lib|bsd}. ..|
|00004630| 5c 73 65 63 74 69 6f 6e | 7b 41 64 64 69 74 69 6f |\section|{Additio|
|00004640| 6e 61 6c 20 43 6f 6d 6d | 65 6e 74 73 7d 20 5c 66 |nal Comm|ents} \f|
|00004650| 6f 6f 74 6e 6f 74 65 20 | 7b 41 64 64 65 64 20 62 |ootnote |{Added b|
|00004660| 79 20 53 76 65 6e 20 47 | 6f 6c 64 74 7d 0a 54 68 |y Sven G|oldt}.Th|
|00004670| 69 73 20 63 68 61 70 74 | 65 72 20 63 6f 76 65 72 |is chapt|er cover|
|00004680| 73 20 6d 6f 73 74 20 6f | 66 20 74 68 65 20 70 6f |s most o|f the po|
|00004690| 72 74 69 6e 67 20 69 73 | 73 75 65 73 20 65 78 63 |rting is|sues exc|
|000046a0| 65 70 74 20 74 68 65 0a | 6d 69 73 73 69 6e 67 20 |ept the.|missing |
|000046b0| 73 79 73 74 65 6d 20 63 | 61 6c 6c 73 20 74 68 61 |system c|alls tha|
|000046c0| 74 20 61 72 65 20 6e 61 | 6d 65 64 20 69 6e 20 74 |t are na|med in t|
|000046d0| 68 65 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 73 20 |he syste|m calls |
|000046e0| 63 68 61 70 74 65 72 0a | 61 6e 64 20 74 68 65 20 |chapter.|and the |
|000046f0| 79 65 74 20 6d 69 73 73 | 69 6e 67 20 73 74 72 65 |yet miss|ing stre|
|00004700| 61 6d 73 20 28 72 75 6d | 6f 72 73 20 73 61 79 20 |ams (rum|ors say |
|00004710| 61 20 6c 6f 61 64 61 62 | 6c 65 20 73 74 72 65 61 |a loadab|le strea|
|00004720| 6d 20 6d 6f 64 75 6c 65 | 0a 73 68 6f 75 6c 64 20 |m module|.should |
|00004730| 65 78 69 73 74 20 61 74 | 20 66 74 70 2e 75 6e 69 |exist at| ftp.uni|
|00004740| 2d 73 74 75 74 74 67 61 | 72 74 2e 64 65 20 69 6e |-stuttga|rt.de in|
|00004750| 20 70 75 62 2f 73 79 73 | 74 65 6d 73 2f 6c 69 6e | pub/sys|tems/lin|
|00004760| 75 78 2f 69 73 64 6e 29 | 2e 0a 0a 0a 5c 65 6e 64 |ux/isdn)|....\end|
|00004770| 69 6e 70 75 74 0a | |input. | |
+--------+-------------------------+-------------------------+--------+--------+